Codeforces Round #477 (rated, Div. 2, based on VK Cup 2018 Round 3)
生活随笔
收集整理的這篇文章主要介紹了
Codeforces Round #477 (rated, Div. 2, based on VK Cup 2018 Round 3)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
點擊打開A題鏈接
#include<bits/stdc++.h> using namespace std; const int MAX = 105; int n,s;int h[MAX],m[MAX],mins[MAX]; int main() {cin>>n>>s;//t[0] = 0;for(int i=0;i<n;++i){cin>>h[i]>>m[i];mins[i] = h[i] * 60 + m[i];}if(mins[0]>=s+1){cout<<0<<" "<<0<<endl;return 0;}bool flag = false;for(int i=1;i<n;++i){if( mins[i]-mins[i-1] >= 2 * (s+1)){flag = 1;cout<< (mins[i-1] + s + 1)/60 <<" "<<(mins[i-1] + s + 1)%60;break;}}if(!flag)cout<< (mins[n-1] + s + 1)/60 <<" "<<(mins[n-1] + s + 1)%60;return 0; }點擊打開B題鏈接
#include<bits/stdc++.h> using namespace std; int main() {int n,a,b;cin>>n>>a>>b;int s[100005];long long S=0;for(int i=0;i<n;++i){scanf("%d",&s[i]);S+=s[i];}sort(s+1,s+n);int ans=0;for(int i=n-1;i>=1;--i){double k=a*s[0]/((double)S*1.0);//cout<<k<<endl;/* if(k>b){cout<<ans<<endl;break;}else{S-=s[i];ans++;}*/if(k < b){S -= s[i];ans ++;}else// break;{//cout<<ans<<endl;break;}}cout<<ans<<endl;return 0; }總結(jié)
以上是生活随笔為你收集整理的Codeforces Round #477 (rated, Div. 2, based on VK Cup 2018 Round 3)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2018 Spring Team Con
- 下一篇: 2018 Spring Team Con