Codeforces Round #249 (Div. 2)
はい。
http://codeforces.com/contest/435
A. Queue on Bus Stop
ざっくりと大意
・バス待ちの集団がnグループありそれぞれが\(a_i\)人である。
・バスの定員はm人で同グループの人はバスを分けては乗らない。
方針のようなもの
・先頭から定員になるまで詰め込む。
n,m=map(int,raw_input().split()) l=[int(x) for x in raw_input().split()] ans=1 while n: chk=0 while n: if chk+l[0]<=m: chk+=l[0] l.pop(0) n-=1 else: ans+=1 break print ans
#include<iostream> #include<cmath> #include<string> #include<cctype> #include<vector> #include<numeric> #include<algorithm> using namespace std; int main(){ int n,m,a,chk=0,ans=1; scanf("%d %d",&n,&m); for(int i=0;i<n;i++){ scanf("%d",&a); if(chk+a<=m){ chk+=a; }else{ chk=a; ++ans; } } printf("%d\n",ans); return 0; }
B. Pasha Maximizes
ざっくりと大意
・k回のswapで作ることが出来る最大の数を出力する。
方針のようなもの
・後で。
C. Cardiogram
ざっくりと大意
・/と\を折れ線グラフになるような出力をする。
方針のようなもの
・後で。