結果
問題 | No.293 4>7の世界 |
ユーザー | takatowin |
提出日時 | 2018-01-03 23:55:56 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 554 bytes |
コンパイル時間 | 460 ms |
コンパイル使用メモリ | 21,632 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 02:34:22 |
合計ジャッジ時間 | 1,336 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:6:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[100]’ [-Wformat=] 6 | scanf("%s",&a); | ~^ ~~ | | | | | char (*)[100] | char * main.c:7:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[100]’ [-Wformat=] 7 | scanf("%s",&b); | ~^ ~~ | | | | | char (*)[100] | char * main.c:6:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%s",&a); | ^~~~~~~~~~~~~~ main.c:7:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%s",&b); | ^~~~~~~~~~~~~~
ソースコード
#include<stdio.h>#include<string.h>#include<stdlib.h>int main(){char i,a[100],b[100];scanf("%s",&a);scanf("%s",&b);if(strlen(a)>strlen(b))puts(a);else if(strlen(a)<strlen(b))puts(b);elsefor(i=0;i<strlen(a);i++){if(a[i]=='7' && b[i]=='4'){puts(b);break;}else if(a[i]=='4' && b[i]=='7'){puts(a);break;}else if(a[i]>b[i]){puts(a);break;}else if(a[i]<b[i]){puts(b);break;}}}