結果

問題 No.128 お年玉(1)
ユーザー toto
提出日時 2025-03-27 10:04:39
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 373 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 27,008 KB
実行使用メモリ 14,768 KB
最終ジャッジ日時 2025-03-27 10:04:46
合計ジャッジ時間 6,898 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other TLE * 1 -- * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%lld",&money);
      |         ~~~~~^~~~~~~~~~~~~~~
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%d",&people);
      |         ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	// 配布可能な金額
	long long money = 0;
	scanf("%lld",&money);
	// 配布する人数
	int people = 0;
	scanf("%d",&people);
	
	// 現在の総配布金額
	int sum = 0;
	// 1000円を配布する回数
	int count = 0;
	while(sum < money){
		sum += people * 1000;
		if(sum <= money){
			count++;	
		}
	}
	printf("%d",count * 1000);
}
0