답안 #245116

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
245116 2020-07-05T13:57:30 Z urd05 동전 게임 (KOI15_coin) C++14
100 / 100
32 ms 1280 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int k,c;
    scanf("%d %d",&k,&c);
    for(int i=0;i<c;i++) {
        int m,n;
        scanf("%d %d",&m,&n);
        if (m==n) {
            printf("1\n");
            continue;
        }
        if (m>n) {
            if (n+k-m+1<m-1) {
                printf("0\n");
            }
            else {
                printf("1\n");
            }
        }
        else {
            if (m+k-n<n-1) {
                printf("0\n");
            }
            else {
                printf("1\n");
            }
        }
    }
}

Compilation message

coin.cpp: In function 'int main()':
coin.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&k,&c);
     ~~~~~^~~~~~~~~~~~~~~
coin.cpp:9:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d",&m,&n);
         ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 27 ms 896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 416 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 18 ms 768 KB Output is correct
4 Correct 24 ms 1152 KB Output is correct
5 Correct 31 ms 1280 KB Output is correct
6 Correct 31 ms 1280 KB Output is correct
7 Correct 31 ms 1232 KB Output is correct
8 Correct 32 ms 1280 KB Output is correct