結果
問題 |
No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
|
ユーザー |
![]() |
提出日時 | 2017-06-03 16:59:09 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 672 bytes |
コンパイル時間 | 144 ms |
コンパイル使用メモリ | 23,424 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 04:36:37 |
合計ジャッジ時間 | 924 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 26 WA * 2 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:17:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%d%d",&n,&k); | ^~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> int manp(const void *a,const void *b){ return *(char *)b-*(char *)a; } int main(void) { int n,k; scanf("%d%d",&n,&k); if(n%2==0){ if(k%2==0){ if(k!=0&&k<=n&&(k!=1&&n!=1)){ printf("%d\n",n-2); }else{printf("0\n");} }else{ if(k!=0&&k<=n&&(k!=1&&n!=1)){ printf("%d\n",n-2); }else{ printf("0\n"); } } }else{ if(k%2==0){ if((k!=0&&k<n)&&(k!=1&&n!=1)){ printf("%d\n",n-1); }else{ printf("0\n"); } }else{ if(k!=0&&k<n&&(k!=1&&n!=1)){ printf("%d\n",n-1); }else{ printf("0\n"); } } } return 0; }