結果

問題 No.3221 Count Turns
コンテスト
ユーザー vjudge1
提出日時 2025-10-26 17:19:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 491 bytes
コンパイル時間 1,248 ms
コンパイル使用メモリ 162,628 KB
実行使用メモリ 11,172 KB
最終ジャッジ日時 2025-10-26 17:19:50
合計ジャッジ時間 5,300 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 2 TLE * 1 -- * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
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("%d%d%d",&n,&h,&t);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int a[100010],b[100010],c[100010];
int main(){
	int n,h,t;
	scanf("%d%d%d",&n,&h,&t);
	for (int i=1;i<=n;i++){
		cin>>a[i];
	}
	while (t--){
		int maxx=0,flg=1;
		while (flg){
			for (int i=1;i<=n;i++){
				b[i]+=a[i];
				if (b[i]>=h){
					maxx=max(maxx,b[i]);
					flg=0;
				}
			}
		}
		for (int i=1;i<=n;i++){
			if (b[i]==maxx){
				b[i]=0;
				c[i]++;
				break;
			}
		}
	}
	for (int i=1;i<=n;i++){
		printf("%d ",c[i]);
	}
	return 0;
}
0