結果
問題 | No.358 も~っと!門松列 |
ユーザー | yfujita0929 |
提出日時 | 2016-04-17 23:02:30 |
言語 | C90 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 1,303 bytes |
コンパイル時間 | 241 ms |
コンパイル使用メモリ | 22,016 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-04-15 02:24:23 |
合計ジャッジ時間 | 972 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 0 ms
6,940 KB |
testcase_02 | AC | 1 ms
6,940 KB |
testcase_03 | AC | 0 ms
6,944 KB |
testcase_04 | AC | 0 ms
6,940 KB |
testcase_05 | AC | 0 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,940 KB |
testcase_07 | AC | 1 ms
6,944 KB |
testcase_08 | AC | 1 ms
6,944 KB |
testcase_09 | AC | 1 ms
6,944 KB |
testcase_10 | AC | 0 ms
6,944 KB |
testcase_11 | AC | 1 ms
6,940 KB |
testcase_12 | AC | 1 ms
6,940 KB |
testcase_13 | AC | 1 ms
6,944 KB |
testcase_14 | AC | 1 ms
6,940 KB |
testcase_15 | AC | 1 ms
6,940 KB |
testcase_16 | AC | 1 ms
6,940 KB |
testcase_17 | AC | 1 ms
6,940 KB |
testcase_18 | AC | 0 ms
6,940 KB |
testcase_19 | AC | 1 ms
6,940 KB |
testcase_20 | AC | 0 ms
6,944 KB |
testcase_21 | AC | 1 ms
6,940 KB |
testcase_22 | AC | 0 ms
6,940 KB |
コンパイルメッセージ
main.c: In function ‘main’: main.c:13:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d %d %d", &a1, &a2, &a3); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <stdlib.h> int is_kadomatsu(int a, int b, int c); int max(int a, int b, int c); int min(int a, int b, int c); int main(void) { unsigned int cnt=0; int a1, a2, a3, p, a, b, c; scanf("%d %d %d", &a1, &a2, &a3); if(is_kadomatsu(a1, a2, a3)) { printf("INF\n"); return 0; } for(p = 1; p <= max(a1, a2, a3); p++){ a = a1 % p; b = a2 % p; c = a3 % p; if(is_kadomatsu(a, b, c)) { cnt++; } } printf("%d\n", cnt); return 0; } int is_kadomatsu(int a, int b, int c) { if (a == b || b == c || c == a) { return 0; } if (max(a, b, c) == b || min(a, b, c) == b) { return 1; } return 0; } int max(int a, int b, int c) { if(a > b) { if(a > c) { return a; } else { return c; } } else { if(b > c) { return b; } else { return c; } } } int min(int a, int b, int c) { if(a > b) { if(b > c) { return c; } else { return b; } } else { if(a > c) { return c; } else { return a; } } }