結果
問題 | No.293 4>7の世界 |
ユーザー |
![]() |
提出日時 | 2017-03-11 20:26:56 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 735 bytes |
コンパイル時間 | 1,602 ms |
コンパイル使用メモリ | 159,064 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-30 12:25:20 |
合計ジャッジ時間 | 2,539 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define INF 2000000000 #define MOD 1000000007 typedef long long ll; typedef pair<int, int> P; int main() { int a; int b; cin >> a >> b; string as = to_string(a); string bs = to_string(b); if (as.size()>bs.size()) { cout << a << "\n"; return 0; } else if (as.size()<bs.size()) { cout << b << "\n"; return 0; } for (int i = 0; i < as.size(); i++) { if (as[i]==bs[i]) { continue; } else if (as[i]=='4'&&bs[i]=='7') { cout << a << "\n"; return 0; } else if (bs[i]=='4'&&as[i]=='7') { cout << b << "\n"; return 0; } else if (as[i]>bs[i]) { cout << a << "\n"; return 0; } else if (as[i]<bs[i]) { cout << b << "\n"; return 0; } } }