結果
問題 |
No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
|
ユーザー |
![]() |
提出日時 | 2017-06-02 22:59:52 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 659 bytes |
コンパイル時間 | 232 ms |
コンパイル使用メモリ | 23,168 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-21 23:55:37 |
合計ジャッジ時間 | 1,157 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 8 |
コンパイルメッセージ
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); } printf("0\n"); }else{ if(k%2==0&&k<n&&(k!=1&&n!=1)){ printf("%d\n",n-1); } printf("0\n"); } } return 0; }