Codeforces Round #130 (Div. 2)
来源:互联网 发布:博库数据库 编辑:程序博客网 时间:2024/05/11 02:59
A. Dubstep
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<cmath>#define LL long long#define N 1000000using namespace std;char str[205];bool check(int i){if(str[i]=='W'&&str[i+1]=='U'&&str[i+2]=='B')return true; return false;}int main(){while(scanf("%s",str)!=EOF){bool word=false;for(int i=0;i<strlen(str);i++){if(!check(i)){if(word)printf(" ");for(;i<strlen(str);i++)if(check(i))break;elseprintf("%c",str[i]);i+=2;word=true;}elsei+=2;}cout<<endl;}return 0;}
D. Prizes, Prizes, more Prizes
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<cmath>#define LL long long#define N 1000000using namespace std;struct Node{int cost,idx;}a[5];int n;LL p[50];bool cmp(Node n1,Node n2){return n1.cost>n2.cost;}int main(){while(scanf("%d",&n)!=EOF){for(int i=0;i<n;i++)scanf("%I64d",&p[i]);LL sum=0;for(int i=0;i<5;i++){scanf("%d",&a[i].cost);a[i].idx=i;}sort(a,a+5,cmp);LL cnt[5];memset(cnt,0,sizeof(cnt));for(int i=0;i<n;i++){sum+=p[i];for(int j=0;j<5;j++){cnt[a[j].idx]+=sum/a[j].cost;sum%=a[j].cost;}}printf("%I64d %I64d %I64d %I64d %I64d\n%I64d\n",cnt[0],cnt[1],cnt[2],cnt[3],cnt[4],sum);}return 0;}
0 0
- Codeforces Round #130 (Div. 2)
- Codeforces Round #130 (Div. 2)
- Codeforces Round #130 (Div. 2)
- Codeforces Round #130 (Div. 2) A题
- Codeforces Round #102 (Div. 2)
- Codeforces Round #103 (Div. 2)
- Codeforces Round #103 (Div. 2)
- Codeforces Round #104 (Div. 2)
- Codeforces Round #105 (Div. 2)
- Codeforces Round #105 (Div. 2)
- Codeforces Round #107 (Div. 2)
- Codeforces Round #108 (Div. 2)
- Codeforces Round #110 (Div. 2)
- Codeforces Round #122 (Div. 2)
- Codeforces Round #121 (Div. 2)
- Codeforces Round #124 (Div. 2)
- Codeforces Round #124 (Div. 2)
- Codeforces Round #125 (Div. 2)
- opencv实现导向滤波(GuidedFilter)
- java UUID生成唯一标识符
- Python逻辑行与物理行
- MySQL与MongoDB设计实例对比
- Qt第三方库QCustomPlot——QCustomPlot解读
- Codeforces Round #130 (Div. 2)
- Codeforces Round #143 (Div. 2) B. Magic, Wizardry and Wonders
- 【Android学习】Android实现两次点击返回键退出程序
- apache .htaccess 禁止访问某目录方法
- 认识Javascript中控制窗口大小的Screen和Window对象
- nginx 配置禁止访问目录或文件
- 【sendRedirect/forward】
- NYOJ-116 士兵杀敌(二)树状数组
- hdu 1008 Elevator 简单模拟