結果
| 問題 |
No.293 4>7の世界
|
| コンテスト | |
| ユーザー |
184
|
| 提出日時 | 2015-10-23 22:44:16 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 471 bytes |
| コンパイル時間 | 677 ms |
| コンパイル使用メモリ | 34,304 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-30 11:15:19 |
| 合計ジャッジ時間 | 1,226 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:39: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | char a[100001],b[100001];scanf("%s%s",a,b);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
//namaega184
int main(){
char a[100001],b[100001];scanf("%s%s",a,b);
int la=strlen(a),lb=strlen(b);
if(la<lb){b:printf("%s\n",b);return 0;}
else if(la>lb){a:printf("%s\n",a);return 0;}
else{
for(int i=0;i<la;i++){
if(a[i]=='7'&&b[i]=='4')goto b;
else if(a[i]=='4'&&b[i]=='7')goto a;
else if(a[i]<b[i])goto b;
else if(a[i]>b[i])goto a;
}
}
printf("-1\n");
return 0;
}
184