Submission #51636

#TimeUsernameProblemLanguageResultExecution timeMemory
51636okaybody10동전 게임 (KOI15_coin)C++98
100 / 100
57 ms2332 KiB
#include <bits/stdc++.h> using namespace std; bool check[1006][1006]; int main() { int k; scanf("%d",&k); for(int i=0;i<=k;i++) { for(int j=0;j<=k;j++) { if (i<=j&&j>i+(k-i+1)/2||i>j&&i>j+(k-j)/2+1) check[i][j]=false; else check[i][j]=true; } } /*check[k][k]=true; check[k][(k+1)/2]=true; for(int i=k-1;i>=0;i--) { if(i>=(k-1)/2) check[k][i]=true; } for(int i=k-1;i>=0;i--) if(i>=(k+1)/2) check[i][k]=true;*/ int c; scanf("%d",&c); while(c--) { int n,m; scanf("%d %d",&n,&m); printf("%d\n",check[n][m]); } return 0; }

Compilation message (stderr)

coin.cpp: In function 'int main()':
coin.cpp:11:21: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
             if (i<=j&&j>i+(k-i+1)/2||i>j&&i>j+(k-j)/2+1) check[i][j]=false;
                 ~~~~^~~~~~~~~~~~~~~
coin.cpp:6:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int k; scanf("%d",&k);
            ~~~~~^~~~~~~~~
coin.cpp:22:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int c; scanf("%d",&c);
            ~~~~~^~~~~~~~~
coin.cpp:25:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int n,m; scanf("%d %d",&n,&m); printf("%d\n",check[n][m]);
                  ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...