結果
問題 |
No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
|
ユーザー |
![]() |
提出日時 | 2017-06-02 23:07:23 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 670 bytes |
コンパイル時間 | 1,265 ms |
コンパイル使用メモリ | 22,912 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 03:15:06 |
合計ジャッジ時間 | 1,846 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 4 |
コンパイルメッセージ
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-2); }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; }