fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <cstdio>
  4. #include <string>
  5. #include <algorithm>
  6. #define MAXN 100010
  7. using namespace std;
  8. int tab[26];
  9. void solve(int n)
  10. {
  11. if(n%2==1)cout <<n/2 << " + " << n/2+1<<"\n";
  12. else
  13. {
  14. if(n%3==0)cout << n/3-1 << " + " << n/3 << " + " << n/3+1<<"\n";else cout <<"BRAK\n";
  15. }
  16. }
  17. int main() {
  18. int t;
  19. cin >> t;
  20. while(t--)
  21. {
  22. int n;
  23. cin >> n;
  24. cout << n << "=";
  25. solve(n);
  26. }
  27. }
Success #stdin #stdout 0s 15240KB
stdin
3
2
15
18
stdout
2=BRAK
15=7 + 8
18=5 + 6 + 7