fork download
  1. //Bai 1: ghi n chu so thap phan cua PI
  2. #include <bits/stdc++.h>
  3. int main() {
  4. int n;
  5. scanf("%d", &n);
  6. char s[18] = "3.141592653589793";
  7. s[n + (!n ? 1 : 2)] = '\0';
  8. return !printf("%s", s);
  9. }
  10.  
  11. //Bai 2: xac dinh thu cua ngay dd/mm/yyyy
  12. #include <bits/stdc++.h>
  13. const char ans[7][3] = {"CN", "T2", "T3", "T4", "T5", "T6", "T7"};
  14. const int dp[11] = {31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
  15. int main() {
  16. int d, m, y, cnt;
  17. scanf("%d%d%d", &d, &m, &y);
  18. cnt = y * 366 - (y - y / 4) + (y - y / 100) + dp[m - 1] + d;
  19. cnt += (int)(m > 2 && (y % 4 == 0 || y % 400 == 0 && y % 100 != 0));
  20. return !printf("%s", ans[cnt % 7]);
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:15:5: error: redefinition of 'main'
int main() {
    ^
prog.cpp:3:5: note: previous definition is here
int main() {
    ^
prog.cpp:19:52: warning: '&&' within '||' [-Wlogical-op-parentheses]
        cnt += (int)(m > 2 && (y % 4 == 0 || y % 400 == 0 && y % 100 != 0));
                                          ~~ ~~~~~~~~~~~~~^~~~~~~~~~~~~~~
prog.cpp:19:52: note: place parentheses around the '&&' expression to silence this warning
        cnt += (int)(m > 2 && (y % 4 == 0 || y % 400 == 0 && y % 100 != 0));
                                                          ^
                                             (                           )
1 warning and 1 error generated.
stdout
Standard output is empty