fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int main(){
  5. int S, a, b, c;
  6. cin>>S;
  7. if(S%3==0){
  8. a=S/3-1;
  9. b=S/3;
  10. c=S/3+1;
  11. cout<<a<<" "<<b<<" "<<c;
  12. return 0;
  13. }
  14. if(S==0){
  15. cout<<"1 -1 0";
  16. return 0;
  17. }
  18. cout<<S%10<<" "<<S/10<<" "<<S-S%10-S/10;
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5288KB
stdin
1
stdout
1 0 0