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 ...
随机推荐
- Shader开发之三大着色器
固定功能管线着色器Fixed Function Shaders 固定功能管线着色器的关键代码一般都在Pass的材质设置Material{}和纹理设置SetTexture{}部分. Shader &qu ...
- spark 安装配置
最佳参考链接 https://opensourceteam.gitbooks.io/bigdata/content/spark/install/spark-160-bin-hadoop26an_zhu ...
- Spark-Hadoop、Hive、Spark 之间是什么关系?(转)
大数据本身是个很宽泛的概念,Hadoop生态圈(或者泛生态圈)基本上都是为了处理超过单机尺度的数据处理而诞生的.你可以把它比作一个厨房所以需要的各种工具.锅碗瓢盆,各有各的用处,互相之间又有重合.你可 ...
- asp.net基于windows服务实现定时发送邮件的方法
本文实例讲述了asp.net基于windows服务实现定时发送邮件的方法.分享给大家供大家参考,具体如下: //定义组件 private System.Timers.Timer time; publi ...
- shell脚本中判断一个字符串是否是空字符串
需求说明: 在写脚本的时候,有的时候,需要判断一个字符串是否为空,因此,在此写出如何判断一个字符串为空的方法. 简单来说,就是字符串的比较. 测试脚本: 以下的脚本用于测试str_1和str_2是否是 ...
- usb摄像头的检测
下面写一下过程: 如果你能在http://www.ideasonboard.org/uvc/找到你的摄像头的ID,即UVC支持的,那么就可以在linux下使用了.至于从哪个版本开始内核支持UVC,官方 ...
- Effective C++ Item 19 Treat class design as type design
Too high class topic for me now ................... ................... ................... fill the ...
- 浅谈ITIL
本节内容 浅谈ITIL CMDB介绍 Django自定义用户认证 Restful 规范 资产管理功能开发 浅谈ITIL TIL即IT基础架构库(Information Technology Infra ...
- shell基础(八)-循环语句
国庆过后:感觉有点慵懒些了:接着上篇:我们继续来学习循环语句. 一. for循环 与其他编程语言类似,Shell支持for循环. for循环一般格式为: for 变量 in 列表 do command ...
- linux命令之find和locate
1.find / -name log.xml 按照名字查找log.xml文件 2.locate log.xml 查找log.xml文件(效率高) 3.grep 'hive' word. ...