結果

問題 No.531 エヌスクミ島の平和協定
ユーザー akakimidori
提出日時 2017-06-23 22:46:14
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 286 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 20,480 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-19 16:19:38
合計ジャッジ時間 1,039 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 37
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘run’:
main.c:5:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |   scanf("%d%d",&n,&m);
      |   ^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

void run(void){
  int n,m;
  scanf("%d%d",&n,&m);
  if(n<=m){
    printf("1\n");
  } else if(2*m>=n){
    if(n%2==1){
      printf("-1\n");
    } else {
      printf("2\n");
    }
  } else {
    printf("-1\n");
  }
  return;
}

int main(void){
  run();
  return 0;
}
0