結果
問題 | No.293 4>7の世界 |
ユーザー |
![]() |
提出日時 | 2017-07-09 09:27:14 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 544 bytes |
コンパイル時間 | 267 ms |
コンパイル使用メモリ | 23,296 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-30 12:33:32 |
合計ジャッジ時間 | 1,038 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 3 | main(){ | ^~~~ main.cpp: In function ‘int main()’: main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%s %s",A,B); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include<stdio.h>#include<string.h>main(){char A[11],B[11];scanf("%s %s",A,B);if(strlen(A) != strlen(B)){printf("%s\n",strlen(A)>strlen(B) ? A:B);}else{for(int i = 0;i < strlen(A);i++){if(A[i] == B[i]){continue;}if(A[i] == '4' && B[i] == '7'){printf("%s\n",A);}else if(A[i] == '7' && B[i] == '4'){printf("%s\n",B);}else{printf("%s\n",A[i]>B[i]?A:B);}break;}}}