Codeforces Round #434 (Div. 2, based on Technocup 2018 Elimination Round 1)
A. k-rounding
题目意思:给两个数n和m,现在让你输出一个数ans,ans是n倍数且末尾要有m个0;
题目思路:我们知道一个数末尾0的个数和其质因数中2的数量和5的数量的最小值有关系,所以我们可以把n中的2和5的因子数量分别算出来,然后看一下是否都大于等于m,否则我们就把他们补成m个。然后再乘回去就结束了。
题目链接:http://codeforces.com/contest/861/problem/A
代码:
/* ***********************************************
Author :xiaowuga
Created Time :2017年10月02日 星期一 18时00分24秒
File Name :A.cpp
************************************************ */
#include <bits/stdc++.h>
#define mem(s,ch) memset(s,ch,sizeof(s))
typedef long long LL;
#define inf 0x3f3f3f3f
const long long N=;
const long long mod=1e9+;
using namespace std;
int main(){
ios::sync_with_stdio(false);cin.tie();
LL n,k;
cin>>n>>k;
LL c1=,c2=;
LL t=n;
while(t%==){
c1++;
t/=;
}
while(t%==){
c2++;
t/=;
}
while(c1<k) c1++;
while(c2<k) c2++;
for(int i=;i<c1;i++){
t*=;
}
for(int i=;i<c2;i++){
t*=;
}
cout<<t<<endl;
return ;
}
B. Which floor?
题目意思:小明住在一个每层楼都有相同数量房间的大楼里面,但是他忘记每层楼有多少个房间了。现在他只记得某些房间在几楼,现在让你根据小明的记忆,判断编号为n的房间在哪一楼是否可以确定。(房间的编号从1-n)从底层到高层;
题目思路:我们发现数据范围很小,这意味这我们可以暴力枚举每层有多少间房间,然后和小明的记忆进行比对,然后把符合小明记忆的数量存起来,然后最后判断他们指出编号为n的房间的楼层是否相同,如果不同就输出-1.
题目链接:http://codeforces.com/contest/861/problem/B
代码:
/* ***********************************************
Author :xiaowuga
Created Time :2017年10月02日 星期一 18时48分45秒
File Name :B.cpp
************************************************ */
#include <bits/stdc++.h>
#define mem(s,ch) memset(s,ch,sizeof(s))
typedef long long LL;
#define inf 0x3f3f3f3f
const long long N=;
const long long mod=1e9+;
using namespace std;
vector<pair<int,int> >q;
vector<int>p;
int main(){
ios::sync_with_stdio(false);cin.tie();
int n,k;
cin>>n>>k;
q.resize(k+);
for(int i=;i<k;i++) {
cin>>q[i].first>>q[i].second;
}
int ct=;
int ans=;
for(int i=;i<=;i++){
int cnt=;
for(int j=;j<k;j++){
int x=q[j].first,y=q[j].second;
int l;
if(x%i==) l=;else l=;
int z=x/i+l;
if(z==y) cnt++;
else break;
}
if(cnt==k){
ct++;
p.push_back(i);
}
}
if(ct==) cout<<-<<endl;
else if(ct==){
cout<<(n/p[]+(n%p[]!=))<<endl;
}
else{
ans=(n/p[]+(n%p[]!=));
for(int i=;i<p.size();i++){
int a=n/p[i]+(n%p[i]!=);
if(a!=ans){cout<<-<<endl; return ;}
}
cout<<ans<<endl;
}
return ;
}
C. Did you mean...
题目意思:有一个字符串,如果有超过三个以上的辅音字母连续出现就需要添加一个空格,三个都是辅音字母都是一样的则不算,em…………直接模拟就好了,做的时候没有读懂题目的意思,简直GG
题目思路:每次发现累计三个辅音字母就判断一个三个是不是一样的,如果是就那么计数器减减,否则就在最后一个辅音字母输出的前面加一个空格,然后计数器清为1,如果碰到原因字母计数器清为0。
代码:
/* ***********************************************
Author :xiaowuga
Created Time :2017年10月02日 星期一 20时05分34秒
File Name :C.cpp
************************************************ */
#include <bits/stdc++.h>
#define mem(s,ch) memset(s,ch,sizeof(s))
typedef long long LL;
#define inf 0x3f3f3f3f
const long long N=;
const long long mod=1e9+;
using namespace std;
int check(char a){
if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u') return ;
else return ;
}
int main(){
ios::sync_with_stdio(false);cin.tie();
string q;
cin>>q;
int len=q.size();
int ct=;
for(int i=;i<len;i++){
if(!check(q[i])){
ct++;
if(ct>=){
if(q[i-]==q[i]&&q[i]==q[i-]) ct--;
else {
cout<<' ';
ct=;
}
} }
else ct=;
cout<<q[i];
}
cout<<endl;
return ;
}
Codeforces Round #434 (Div. 2, based on Technocup 2018 Elimination Round 1)的更多相关文章
- Codeforces Round #434 (Div. 2, based on Technocup 2018 Elimination Round 1)&&Codeforces 861C Did you mean...【字符串枚举,暴力】
C. Did you mean... time limit per test:1 second memory limit per test:256 megabytes input:standard i ...
- Codeforces Round #434 (Div. 2, based on Technocup 2018 Elimination Round 1)&&Codeforces 861B Which floor?【枚举,暴力】
B. Which floor? time limit per test:1 second memory limit per test:256 megabytes input:standard inpu ...
- Codeforces Round #434 (Div. 2, based on Technocup 2018 Elimination Round 1)&&Codeforces 861A k-rounding【暴力】
A. k-rounding time limit per test:1 second memory limit per test:256 megabytes input:standard input ...
- 【模拟】 Codeforces Round #434 (Div. 1, based on Technocup 2018 Elimination Round 1) C. Tests Renumeration
题意:有一堆数据,某些是样例数据(假设X个),某些是大数据(假设Y个),但这些数据文件的命名非常混乱.要你给它们一个一个地重命名,保证任意时刻没有重名文件的前提之下,使得样例数据命名为1~X,大数据命 ...
- Codeforces Round #440 (Div. 2, based on Technocup 2018 Elimination Round 2)
A. Search for Pretty Integers 题目链接:http://codeforces.com/contest/872/problem/A 题目意思:题目很简单,找到一个数,组成这个 ...
- Codeforces Round #440 (Div. 2, based on Technocup 2018 Elimination Round 2) D. Something with XOR Queries
地址:http://codeforces.com/contest/872/problem/D 题目: D. Something with XOR Queries time limit per test ...
- Codeforces Round #440 (Div. 1, based on Technocup 2018 Elimination Round 2) C - Points, Lines and Ready-made Titles
C - Points, Lines and Ready-made Titles 把行列看成是图上的点, 一个点(x, y)就相当于x行 向 y列建立一条边, 我们能得出如果一个联通块是一棵树方案数是2 ...
- Codeforces Round #440 (Div. 2, based on Technocup 2018 Elimination Round 2) C. Maximum splitting
地址: 题目: C. Maximum splitting time limit per test 2 seconds memory limit per test 256 megabytes input ...
- ACM-ICPC (10/15) Codeforces Round #440 (Div. 2, based on Technocup 2018 Elimination Round 2)
A. Search for Pretty Integers You are given two lists of non-zero digits. Let's call an integer pret ...
随机推荐
- mongodb自动关闭:页面太小,无法完成操作
解决方法: 增大虚拟内存
- MySql csv文件导入导出
一.导出到csv(本地导出) 通过mysql客户端shell连接到服务器,选择使用的数据库,输入sql代码: select * from test_info into outfile '/tmp/te ...
- Spring部署报错:Could not open ServletContext resource [/db.properties]
在使用Spring MVC过程中,部署项目报错,报错信息如下: 八月 15, 2016 5:02:04 下午 org.apache.catalina.core.StandardContext list ...
- C++字符串转化为数字的库函数
原文链接:http://blog.csdn.net/tsinfeng/article/details/5844838 1.atoi 功 能:把一字符串转换为整数 用 法:int atoi(const ...
- sqlserver 字符串split
select value from TF_NJVALUES('3C457A2D-188B-4D99-A822-2968054E1FB8,3C457A2D-188B-4D99-A822-2968054E ...
- ThinkPHP导出CSV、Excel
Thinkphp/Library/Think下新文件文件:Csv.class.php <?php namespace Think; class Csv { //导出csv文件 public fu ...
- u3d调用c++ dll的DllNotFoundExceion 问题
原文地址:http://blog.csdn.net/boren31/article/details/8778504 问题年年有,今年特别多. 开发环境: Windows XP sp3 Visual ...
- Upgrade site collection from SP2010 to SP2013(Part 2)
内容中包含 base64string 图片造成字符过多,拒绝显示
- linux,shell中if else if的写法,if elif
需求描述: 在写shell脚本的过程中,用到了if else的写法,突然有多个参数需要判断 那么就想到了if else if的用法,于是进行如下的测试. 测试过程: 1.写如下的测试脚本,进行多个值的 ...
- Spring学习笔记--声明一个简单的Bean
spring依赖的maven dependencyhttp://mvnrepository.com/artifact/org.springframework 在pom.xml中添加如下依赖: < ...