Advertisement
SergeyPGUTI

3.1.10

Sep 25th, 2015
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int n,P1,P5,P10,P20,P60;
  9.     cin>>n;
  10.     P60=n/60;
  11.     n=n%60;
  12.     P20=n/20;
  13.     n=n%20;
  14.     P10=n/10;
  15.     n=n%10;
  16.     P5=n/5;
  17.     n=n%5;
  18.     P1=n;
  19.     if (P1*15>=70)
  20.     {
  21.         P1=0;
  22.         P5++;
  23.     }
  24.     if (P5*70+P1*15>=125)
  25.     {
  26.         P1=0;
  27.         P5=0;
  28.         P10++;
  29.     }
  30.     if (P10*125+P5*70+P1*15>=230)
  31.     {
  32.         P1=0;
  33.         P5=0;
  34.         P10=0;
  35.         P20++;
  36.     }
  37.     if (440<=P20*230+P10*125+P5*70+P1*15)
  38.     {
  39.         P10=0;
  40.         P1=0;
  41.         P5=0;
  42.         P20=0;
  43.         P60++;
  44.     }
  45.     cout<<P1<<" "<<P5<<" "<<P10<<" "<<P20<<" "<<P60;
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement