답안 #51636

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
51636 2018-06-19T12:01:43 Z okaybody10 동전 게임 (KOI15_coin) C++
100 / 100
57 ms 2332 KB
#include <bits/stdc++.h>
using namespace std;
bool check[1006][1006];
int main()
{
    int k; scanf("%d",&k);
    for(int i=0;i<=k;i++)
    {
        for(int j=0;j<=k;j++)
        {
            if (i<=j&&j>i+(k-i+1)/2||i>j&&i>j+(k-j)/2+1) check[i][j]=false;
            else check[i][j]=true;
        }
    }
    /*check[k][k]=true;
    check[k][(k+1)/2]=true;
    for(int i=k-1;i>=0;i--)
    {
        if(i>=(k-1)/2) check[k][i]=true;
    }
    for(int i=k-1;i>=0;i--) if(i>=(k+1)/2) check[i][k]=true;*/
    int c; scanf("%d",&c);
    while(c--)
    {
        int n,m; scanf("%d %d",&n,&m); printf("%d\n",check[n][m]);
    }
    return 0;
}

Compilation message

coin.cpp: In function 'int main()':
coin.cpp:11:21: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
             if (i<=j&&j>i+(k-i+1)/2||i>j&&i>j+(k-j)/2+1) check[i][j]=false;
                 ~~~~^~~~~~~~~~~~~~~
coin.cpp:6:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int k; scanf("%d",&k);
            ~~~~~^~~~~~~~~
coin.cpp:22:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int c; scanf("%d",&c);
            ~~~~~^~~~~~~~~
coin.cpp:25:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int n,m; scanf("%d %d",&n,&m); printf("%d\n",check[n][m]);
                  ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 420 KB Output is correct
4 Correct 2 ms 440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 444 KB Output is correct
2 Correct 2 ms 452 KB Output is correct
3 Correct 2 ms 632 KB Output is correct
4 Correct 2 ms 632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 632 KB Output is correct
2 Correct 2 ms 632 KB Output is correct
3 Correct 5 ms 632 KB Output is correct
4 Correct 31 ms 1224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1224 KB Output is correct
2 Correct 3 ms 1224 KB Output is correct
3 Correct 19 ms 1748 KB Output is correct
4 Correct 26 ms 2052 KB Output is correct
5 Correct 57 ms 2332 KB Output is correct
6 Correct 51 ms 2332 KB Output is correct
7 Correct 45 ms 2332 KB Output is correct
8 Correct 40 ms 2332 KB Output is correct