Submission #134102

# Submission time Handle Problem Language Result Execution time Memory
134102 2019-07-22T04:43:57 Z ansol4328 동전 게임 (KOI15_coin) C++11
100 / 100
28 ms 1272 KB
#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

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 time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 452 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Correct 21 ms 888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 15 ms 760 KB Output is correct
4 Correct 19 ms 1016 KB Output is correct
5 Correct 27 ms 1148 KB Output is correct
6 Correct 28 ms 1272 KB Output is correct
7 Correct 26 ms 1144 KB Output is correct
8 Correct 28 ms 1272 KB Output is correct