結果
| 問題 | No.207 世界のなんとか |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-28 13:42:48 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
RE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 738 bytes |
| 記録 | |
| コンパイル時間 | 827 ms |
| コンパイル使用メモリ | 21,504 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-11 22:53:57 |
| 合計ジャッジ時間 | 1,978 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 RE * 5 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:12:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%d%d", &A, &B);
| ^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <stdlib.h>
int strlength(char c[]);
int strinclude(char c[]);
int main(void)
{
int A, B;
char s[10];
scanf("%d%d", &A, &B);
for(A;A<=B;A++){
sprintf(s,"%d",A);
if(strinclude(s) == 1 || A%3 ==0 ){
printf("%s\n",s);
}
}
return 0;
}
// 与えられた文字列の桁数を返す
int strlength(char c[]){
int len = 0;
while(c[len] != 0){
len++;
}
return len;
}
// 与えられた文字列中に"3"があれば1、なければ0を返す
int strinclude(char c[]){
int i;
int len1;
len1 = strlength(c);
for(i = 0; i <= len1; i++){
if(c[i] == '3'){
return 1;
// return 0;
}
}
return 0;
}