fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
  5. #define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)
  6. #define REP(i,a) for(int i=0,_a=(a); i<_a; i++)
  7. #define EACH(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
  8. #define SZ(S) ((int) ((S).size()))
  9.  
  10. #define DEBUG(x) { cout << #x << " = " << x << endl; }
  11. #define PR(a,n) { cout << #a << " = "; FOR(_,1,n) cout << a[_] << ' '; cout << endl; }
  12. #define PR0(a,n) { cout << #a << " = "; REP(_,n) cout << a[_] << ' '; cout << endl; }
  13.  
  14. int main() {
  15. ios :: sync_with_stdio(false); cin.tie(NULL);
  16. cout << (fixed) << setprecision(6);
  17. int a, b, c;
  18. while (cin >> a >> b >> c && a) {
  19. if (a == b && b == c) { // set
  20. if (a == 13) cout << '*' << endl;
  21. else {
  22. int x = a + 1;
  23. cout << x << ' ' << x << ' ' << x << endl;
  24. }
  25. }
  26. else if (a != b && b != c && c != a) {
  27. cout << 1 << ' ' << 1 << ' ' << 2 << endl;
  28. }
  29. else {
  30. int x, y;
  31. if (a == b) x = a, y = c;
  32. if (b == c) x = b, y = a;
  33. if (c == a) x = c, y = b;
  34.  
  35. vector<int> res;
  36. bool ok = false;
  37. FOR(i,1,13) FOR(j,1,13) if (i != j) {
  38. if (ok) break;
  39.  
  40. if (i > x || (i == x && j > y)) {
  41. ok = true;
  42. res = vector<int> {i, i, j};
  43. break;
  44. }
  45. }
  46. if (!ok) res = vector<int> {1,1,1};
  47. sort(res.begin(), res.end());
  48. cout << res[0] << ' ' << res[1] << ' ' << res[2] << endl;
  49. }
  50. }
  51. return 0;
  52. }
  53.  
  54.  
Success #stdin #stdout 0s 3436KB
stdin
111
1 1 12
1 1 13
1 13 1
10 13 10
122
13 13 13
13 12 13
12 12 12
314
159
000
stdout
1 2 2
1 1 13
2 13 13
1 1 2
1 1 2
*
1 13 13
1 13 13