結果
問題 | No.293 4>7の世界 |
ユーザー |
|
提出日時 | 2015-10-23 22:47:07 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 664 bytes |
コンパイル時間 | 699 ms |
コンパイル使用メモリ | 61,656 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-30 11:15:46 |
合計ジャッジ時間 | 1,597 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <iostream>#include <string>#include <cstring>#include <stack>using namespace std;bool comp(int n, int m){if (n == 4 && m == 7) return true;if (n == 7 && m == 4) return false;if (n > m) return true;return false;}int main(){long long a, b,aa,bb;cin >> a >> b;aa = a;bb = b;stack<int> sa, sb;while (a > 0 || b > 0) {sa.push(a % 10);a /= 10;sb.push(b % 10);b /= 10;}while (!sa.empty()) {if (sa.top() == sb.top()) {sa.pop();sb.pop();}else if (comp(sa.top(), sb.top())) {cout << aa << endl;return 0;}else {cout << bb << endl;return 0;}}return 0;}