Saleh127

CF 1430A

Oct 11th, 2020 (edited)
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5.  
  6. int main()
  7. {
  8. ios_base::sync_with_stdio(0);
  9. cin.tie(0);
  10. cout.tie(0);
  11. ///!]B
  12. test
  13. {
  14. ll a=0,c=0,d=0,e,f,i,j,k,l,n;
  15. cin>>n;
  16. if(n<=4 && n!=3)
  17. {
  18. cout<<-1<<endl;
  19. continue;
  20. }
  21.  
  22. c=n/5;
  23. if(n%5==1)
  24. {
  25. c--;
  26. a+=2;
  27. }
  28. else if(n%5==2)
  29. {
  30. d++;
  31. c--;
  32. }
  33. else if(n%5==3)
  34. {
  35. a++;
  36. }
  37. else if(n%5==4)
  38. {
  39. c--;
  40. a+=3;
  41. }
  42. cout<<a<<" "<<c<<" "<<d<<endl;
  43. }
  44.  
  45.  
  46. return 0;
  47. }
  48.  
Add Comment
Please, Sign In to add comment