Submission #134102

#TimeUsernameProblemLanguageResultExecution timeMemory
134102ansol4328동전 게임 (KOI15_coin)C++11
100 / 100
28 ms1272 KiB
#include<stdio.h> #include<algorithm> using namespace std; int k, n; int a, b; int main() { scanf("%d %d",&k,&n); for(int i=1 ; i<=n ; i++) { scanf("%d %d",&a,&b); int mval=min(a,b); a-=mval, b-=mval; int x=k-mval; if((a<=(x+2)/2 && b==0) || (a==0 && b<=(x+1)/2)) printf("1\n"); else printf("0\n"); } return 0; }

Compilation message (stderr)

coin.cpp: In function 'int main()':
coin.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&k,&n);
     ~~~~~^~~~~~~~~~~~~~~
coin.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d",&a,&b);
         ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...