답안 #58400

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
58400 2018-07-17T17:43:10 Z andy627 동전 게임 (KOI15_coin) C++17
100 / 100
45 ms 5312 KB
#include <stdio.h>
#include <algorithm>
using namespace std;

int n,m;

void solve(){
    int a,b;

    scanf("%d %d",&a,&b);

    if(a>b && (a-1)-b<=n-(a-1)) printf("1\n");
    else if(a<=b && (b-1)-a<=n-b) printf("1\n");
    else printf("0\n");
}

int main(){
    scanf("%d %d",&n,&m);
    while(m--) solve();

    return 0;
}

Compilation message

coin.cpp: In function 'void solve()':
coin.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&a,&b);
     ~~~~~^~~~~~~~~~~~~~~
coin.cpp: In function 'int main()':
coin.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 3 ms 660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 660 KB Output is correct
2 Correct 4 ms 776 KB Output is correct
3 Correct 2 ms 776 KB Output is correct
4 Correct 3 ms 776 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 776 KB Output is correct
2 Correct 3 ms 776 KB Output is correct
3 Correct 6 ms 872 KB Output is correct
4 Correct 26 ms 1392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1392 KB Output is correct
2 Correct 5 ms 1392 KB Output is correct
3 Correct 33 ms 1756 KB Output is correct
4 Correct 43 ms 2244 KB Output is correct
5 Correct 45 ms 3036 KB Output is correct
6 Correct 39 ms 3808 KB Output is correct
7 Correct 34 ms 4492 KB Output is correct
8 Correct 36 ms 5312 KB Output is correct