結果
問題 | No.1624 三角形の反射 |
ユーザー |
👑 |
提出日時 | 2021-07-23 21:50:22 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 997 ms |
コンパイル使用メモリ | 29,312 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-02 09:50:52 |
合計ジャッジ時間 | 1,736 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <stdio.h> int gcd(int a, int b) { if (a == 0) return b; else return gcd(b % a, a); } int main() { char A[10]; scanf("%s", A); int x = 1000, y = 0, i, g; for (i = 0; A[i] != 0; i++) if (A[i] != '.') y = y * 10 + A[i] - '0'; g = gcd(x, y); x /= g; y /= g; if (y % 2 == 0) { if (x % 2 == 0) printf("A "); else printf("B "); } else { if (x % 2 == 0) printf("C "); else printf("A "); } printf("%d\n", x - 1 + y - 1 + ((x > y)? x - 1: y - 1) + ((x % 2 == 1 && y % 2 == 1)? 1: 0)); fflush(stdout); return 0; }