結果

問題 No.207 世界のなんとか
ユーザー mafuyu-akimafuyu-aki
提出日時 2017-03-27 23:45:11
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,733 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 27,180 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-20 14:52:19
合計ジャッジ時間 1,191 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define READ_BUFSIZE ( 32 )
#define READ_DELIMITER ( " " )


//標準入力取得(1行)

int GetStdin( char* pszStr, int lMaxLen )
{
	int lLen = 0;

    memset( pszStr, 0, lMaxLen );
    if( fgets( pszStr, lMaxLen, stdin ) )
    {
	    lLen = strlen( pszStr );
	    if( lLen >= 1 )
	    {
			if( pszStr[ lLen - 1 ] == 0x0A )
			{
				pszStr[ lLen - 1 ] = 0;
				lLen--;
			}
		}
	}
	
	return( lLen );
}


//標準入力を取得
//区切り文字で区切られている文字列を取り出す
//取り出した文字列のポインタをポインタ配列にセットする
int split(char *pszStr, int lStrMax, const char *pszDelim, char *apszOutList[]) {
    char *pszToken;
    int count = 0;
    char *pszNext_token = 0;
	int lLen = 0;
	int lNum = 0;

    memset( pszStr, 0, lStrMax );
    lLen = GetStdin( pszStr, lStrMax );
    
	if( lLen > 0 )
	{

	    pszToken = strtok( pszStr, pszDelim );

	    while ( pszToken != NULL ) 
	    {
            apszOutList[ lNum ] = pszToken;
			lNum++;
//	        pszToken = strtok_s(NULL, pszDelim, &pszNext_token);
		    pszToken = strtok( NULL, pszDelim );
	    }
	}
    return lNum;
}




int main(int argc, char *argv[]) 
{
	char szRead[READ_BUFSIZE] = "";
	char* psOutbuf[2] = { 0 };

	char* psPrintBuf = 0;


	int lNum = split( szRead, READ_BUFSIZE, READ_DELIMITER, psOutbuf );

	if( lNum >= 2 )
	{
		int lMin = atoi( psOutbuf[0] );
		int lMax = atoi( psOutbuf[1] );
		char szTemp[16] = "";

		for( int i = lMin; i <= lMax; i++ )
		{
			memset( szTemp, 0, sizeof( szTemp ) );
			sprintf( szTemp, "%d", i );

			if( strchr( szTemp, '3' ) != 0 || i % 3 == 0 )
			{
				printf( "%d\n", i );
			}
		}
	}


	return 0;

}

0