답안 #113258

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
113258 2019-05-24T13:19:37 Z arnold518 동전 게임 (KOI15_coin) C++14
100 / 100
30 ms 1280 KB
#include <bits/stdc++.h>  
using namespace std;  
  
typedef long long ll;  
typedef pair<int, int> pii;  
typedef pair<ll, ll> pll;  
  
int p, k;  
  
int main()  
{  
    int i, j;  
    scanf("%d%d", &k, &p);  
    while(p--)  
    {  
        int a, b;  
        scanf("%d%d", &a, &b);  
        if(k==1 || (a==0 && b==0) || (a==b)) { printf("1\n"); continue; }  
        if(a>b)  
        {  
            a--;  
            int t=a;  
            t=k-t;  
            if(b+t<a) printf("0");  
            else printf("1");  
        }  
        else  
        {  
            b--;  
            int t=b;  
            t=k-t-1;  
            if(a+t<b) printf("0");  
            else printf("1");  
        }  
        printf("\n");  
    }  
}  

Compilation message

coin.cpp: In function 'int main()':
coin.cpp:13:9: warning: unused variable 'i' [-Wunused-variable]
     int i, j;  
         ^
coin.cpp:13:12: warning: unused variable 'j' [-Wunused-variable]
     int i, j;  
            ^
coin.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &k, &p);  
     ~~~~~^~~~~~~~~~~~~~~~
coin.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &a, &b);  
         ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 21 ms 888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 15 ms 768 KB Output is correct
4 Correct 23 ms 1020 KB Output is correct
5 Correct 27 ms 1280 KB Output is correct
6 Correct 29 ms 1276 KB Output is correct
7 Correct 30 ms 1280 KB Output is correct
8 Correct 29 ms 1268 KB Output is correct