結果
問題 | No.207 世界のなんとか |
ユーザー |
![]() |
提出日時 | 2023-05-29 09:35:35 |
言語 | C90 (gcc 12.3.0) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,301 bytes |
コンパイル時間 | 176 ms |
コンパイル使用メモリ | 20,992 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-28 08:56:07 |
合計ジャッジ時間 | 871 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 RE * 13 |
ソースコード
#include <stdio.h>#include <malloc.h>char str[60000];//(5桁×10000件)+(空白1万-1) = 59999文字まで使われる可能性があるint str_len = 0;/// <summary>/// グローバル変数strの中身を入力された文字列で上書きする/// </summary>void ReadString() {char c = getchar();str_len = 0;while (c != '\n') {str[str_len] = c;c = getchar();str_len++;}}/// <summary>/// ReadStringの文字列のうち、スペースで区切られた左側か右側を取得する/// </summary>/// <param name="leftIs">左が欲しければtrue,右ならfalse</param>/// <returns>引数に対応した側の数字を返す</returns>int GetLR(int leftIs) {int cnt = 0;long num = 0;long left = 0;long right = 0;while (1) {if (cnt >= str_len) {right = num;break;}if (str[cnt] == ' ') {left = num;num = 0;cnt++;continue;}num = num * 10 + (str[cnt] - '0');cnt++;}if (leftIs) {return left;}else {return right;}}long main(){ReadString();long a = GetLR(1);long b = GetLR(0);for (long long i = a;i <= b;i++) {if (i % 3 == 0) {printf("%lld\n",i);continue;}for (long long j = 1LL;j < i * 10;j*=10) {if ((i%(j*10))/j == 3) {printf("%lld\n",i);break;}}}}