Codeforces Round #434
来源:互联网 发布:hadoop wordcount源码 编辑:程序博客网 时间:2024/06/07 03:36
CF858A k-rounding(数论)
#include <bits/stdc++.h>using namespace std;#define ll long long#define inf 0x3f3f3f3f#define N 100010inline int read(){ int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar(); return x*f;}int n,k;inline int do2(int x){ int res=0; while(x&&x%2==0) x/=2,res++; return res;}inline int do5(int x){ int res=0; while(x&&x%5==0) x/=5,res++; return res;}int main(){ n=read();k=read(); int a=do2(n),b=do5(n); if(a>=k&&b>=k) printf("%d\n",n); else{ ll ans=n; while(a<k) ans*=2,++a; while(b<k) ans*=5,++b; printf("%I64d\n",ans); } return 0;}
CF858B Which floor?(暴力)
#include <bits/stdc++.h>using namespace std;#define ll long long#define inf 0x3f3f3f3f#define N 200010#define pa pair<int,int>inline int read(){ int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar(); return x*f;}int n,m,ans=0;pa a[N];inline bool jud(int x){ for(int i=1;i<=m;++i) if((a[i].first-1)/x+1!=a[i].second) return 0; return 1;}int main(){// freopen("a.in","r",stdin); n=read();m=read(); for(int i=1;i<=m;++i){ a[i].first=read();a[i].second=read(); } for(int x=1;x<=100;++x) if(jud(x)){ if(ans&&ans!=(n-1)/x+1){puts("-1");return 0;} else ans=(n-1)/x+1; } printf("%d\n",ans); return 0;}
CF858C Did you mean…(贪心)
#include <bits/stdc++.h>using namespace std;#define ll long long#define inf 0x3f3f3f3f#define N 3110inline int read(){ int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar(); return x*f;}int n;char s[N];bool f[N];int main(){// freopen("a.in","r",stdin); scanf("%s",s+1);n=strlen(s+1); for(int i=1;i<=n;++i) if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u') f[i]=0; else f[i]=1; for(int i=1;i<=n;++i){ if(!f[i]||!f[i+1]||!f[i+2]||(s[i]==s[i+1]&&s[i+1]==s[i+2])) putchar(s[i]); else printf("%c%c ",s[i],s[i+1]),i++; } return 0;}
阅读全文
0 0
- Codeforces Round #434
- Codeforces Round #434
- Codeforces Round #434
- Codeforces Round #434 题解
- Codeforces Round #434 (Div. 2)
- Codeforces Round #434 (Div. 2)
- Codeforces Round #434 (Div.2)
- Codeforces Round #434 (Div. 2)
- Codeforces Round #434 (Div.2)
- Codeforces Round #434 (Div. 2)
- Codeforces Round #434 k-rounding
- Codeforces Round #434 Which floor?
- 【codeforces】Codeforces Round #363
- Codeforces Round #434 Did you mean...
- Codeforces Round #434 Div.1 D graph
- Codeforces Round #270 Codeforces Round #270
- 【Codeforces】Codeforces Round #271 div2
- 【CODEFORCES】 Educational Codeforces Round 1
- C到C++的过渡
- Openlayers3中SVG图加载
- oracle函数(二)
- Lombok使用
- C++中const和C++的引用
- Codeforces Round #434
- 看完这个,css中position的绝对定位相对定位就懂了
- mysql批量插入:语法
- unity 头盔跟随一个物体移动(类似用HTC做过山车效果)
- 帧布局
- Spring定时之Quartz
- 自定义View系列教程01--常用工具介绍
- Kubernetes 针对资源紧缺处理方式的配置
- d-seperation 条件独立性