結果

問題 No.207 世界のなんとか
ユーザー HiroakiSoftware
提出日時 2015-05-15 22:32:35
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 401 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 22,784 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-09 10:08:54
合計ジャッジ時間 817 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf ( "%d %d" , &nA , &nB );
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main ( void ) {

	int nA , nB;

	int flag , buf;
	scanf ( "%d %d" , &nA , &nB );
	
	for ( int n = nA; n <= nB; n++ ){

		if ( ( n % 3 ) == 0 ) {
			printf ( "%d\n" , n );
		} else {
			flag = 0;

			buf = n;
			while ( buf > 0 ) {
				if ( ( buf % 10 ) == 3 ) {
					flag = 1;
					break;
				}
				buf /= 10;
			}
			if (flag == 1 )	printf ( "%d\n" , n );

		}
	}
	return 0;
}
0