結果

問題 No.531 エヌスクミ島の平和協定
ユーザー kikage
提出日時 2020-04-10 19:51:35
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 275 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 22,528 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-15 11:39:01
合計ジャッジ時間 1,493 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 37
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:4:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 |     scanf("%d %d",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
int main(){
    int n,m;
    scanf("%d %d",&n,&m);
    if(n%2==0){
        if(m>=n)printf("1\n");
        else if(2*m>=n)printf("2\n");
        else printf("-1\n");
    }else{
        if(m>=n)printf("1\n");
        else printf("-1\n");
    }
    return 0;
}
0