結果
問題 | No.293 4>7の世界 |
ユーザー |
![]() |
提出日時 | 2019-04-14 20:45:52 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 728 bytes |
コンパイル時間 | 1,061 ms |
コンパイル使用メモリ | 28,800 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 12:08:33 |
合計ジャッジ時間 | 1,538 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
// yukicoder: No.293 4>7の世界// 2019.4.14 bal4u#include <stdio.h>#define gc() getchar()#define pc(c) putchar(c)int ins(char *s) // 文字列の入力 スペース以下の文字で入力終了{char *p = s;do *s = gc();while (*s++ > ' ');*--s = 0;return s - p;}void outs(char *s) { while (*s) pc(*s++); }char A[15]; int wa;char B[15]; int wb;int cmp(int w1, char *s1, int w2, char *s2){if (wa != wb) return wa - wb;while (*s1) {if (*s1 == '4' && *s2 == '7') return 1;else if (*s1 == '7' && *s2 == '4') return -1;else if (*s1 != *s2) return *s1 - *s2;s1++, s2++;}return 0;}int main(){wa = ins(A), wb = ins(B);outs(cmp(wa, A, wb, B) > 0 ? A : B);pc('\n');return 0;}