結果

問題 No.32 貯金箱の憂鬱
ユーザー mafuyu-akimafuyu-aki
提出日時 2017-03-28 00:23:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,040 bytes
コンパイル時間 938 ms
コンパイル使用メモリ 26,612 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-30 10:02:01
合計ジャッジ時間 1,698 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

#define READ_BUFSIZE ( 16 )
#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 main(int argc, char *argv[]) 
{
	char szRead[READ_BUFSIZE] = "";
	char* psOutbuf[2] = { 0 };

	//100円硬貨の枚数
	GetStdin( szRead, READ_BUFSIZE );
	int lNum100 = atoi( szRead );

	//25円硬貨の枚数
	GetStdin( szRead, READ_BUFSIZE );
	int lNum25 = atoi( szRead );

	//1円硬貨の枚数
	GetStdin( szRead, READ_BUFSIZE );
	int lNum1 = atoi( szRead );

	lNum25 += lNum1 / 25;
	lNum1 -= lNum1 / 25 * 25;

	lNum100 += lNum25 / 4;
	lNum25 -= lNum25 / 4 * 4;

	lNum100 -= lNum100 / 10 * 10;

	printf( "%d\n", lNum1 + lNum25 + lNum100  );


	
	return 0;

}

0