Advertisement
apl-mhd

anergyBlb

Jul 27th, 2017
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include <cstdio>
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <vector>
  5. #include <set>
  6. #include <functional>
  7. #include <queue>
  8. #include <utility>
  9. #include <list>
  10. #include <climits>
  11.  
  12. #define P printf("\n");
  13.  
  14. typedef long long int lli;
  15. using namespace std;
  16.  
  17.  
  18. int vend=0, vf;
  19.  
  20. int dp(int total,  int sum){
  21.  
  22.         if(total < 3)
  23.  
  24.             return sum;
  25.  
  26.         vf = total / 3;
  27.         vend = total % 3;
  28.         total = vf+vend;
  29.         sum+=vf;
  30.  
  31.         dp(total, sum);
  32. }
  33.  
  34.  
  35. int main(int argc, char **argv) {
  36.  
  37.     int t, Case=0;
  38.  
  39.     cin>>t;
  40.  
  41.     while(t--){
  42.         lli n, bulb,sum=0;
  43.  
  44.         cin>>n;
  45.  
  46.         sum = n / 100;
  47.  
  48.         sum= dp(sum,sum);
  49.  
  50.         //cout<<sum<<endl;
  51.  
  52.     cout<<"Case "<<Case<<": "<<sum<<" "<<vend+vf<<endl;
  53.     }
  54.  
  55.  
  56.  
  57. return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement