結果
問題 |
No.91 赤、緑、青の石
|
ユーザー |
![]() |
提出日時 | 2016-09-30 01:25:32 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 466 bytes |
コンパイル時間 | 393 ms |
コンパイル使用メモリ | 20,992 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-21 10:57:21 |
合計ジャッジ時間 | 1,965 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 WA * 18 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:27:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 27 | scanf("%d", &n[i]); | ^~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int cnt(int n[3]) { int z, t, i; if (n[0] > 0 && n[1] > 0 && n[2] > 0) { for (i = 0; i < 3; i++) { n[i]--; } return 1 + cnt(n); } else if (n[0] + n[1] + n[2] > 3) { for (i = 0; i < 3; i++) { if (n[i] >= 2) t = i; else if (n[i] == 0) z = i; } n[t] -= 2; n[z]++; return cnt(n); } else return 0; } int main() { int n[3], i; for (i = 0; i < 3; i++) { scanf("%d", &n[i]); } printf("%d\n", cnt(n)); return 0; }