Skip to content

Commit 083358b

Browse files
committed
done
1 parent f84f6b7 commit 083358b

File tree

6 files changed

+44
-2
lines changed

6 files changed

+44
-2
lines changed

CF1.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ int main() {
2323
ll tc;
2424
cin >> tc;
2525
while (tc--) {
26-
26+
ll n,k;
27+
cin>>n>>k;
28+
if(n<k){
29+
double ans=(double)k/n;
30+
cout<<ceil(ans)<<endl;
31+
}
32+
else if(n==k){
33+
cout<<1<<endl;
34+
}
35+
else{
36+
double ans=(double)n/k;
37+
ans=(ceil(ans)*k);
38+
ans/=n;
39+
cout<<ceil(ans)<<endl;
40+
}
2741
}
2842
}

CF1.exe

-41.5 KB
Binary file not shown.

CF2.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,27 @@ int main() {
2323
ll tc;
2424
cin >> tc;
2525
while (tc--) {
26-
26+
ll n;
27+
double k;
28+
cin>>n>>k;
29+
k/=100;
30+
ll sum;
31+
cin>>sum;
32+
ll change=0;
33+
for(ll i=1;i<n;i++){
34+
ll curr;
35+
cin>>curr;
36+
double p=(double)curr/sum;
37+
if(p<=k){}
38+
else{
39+
double now=(double)curr/k;
40+
now=ceil(now);
41+
now-=sum;
42+
change+=now;
43+
sum+=(ll)now;
44+
}
45+
sum+=curr;
46+
}
47+
cout<<change<<endl;
2748
}
2849
}

CF2.exe

4 Bytes
Binary file not shown.

input.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2
2+
4 1
3+
20100 1 202 202
4+
3 100
5+
1 1 1

output.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
99
2+
0

0 commit comments

Comments
 (0)