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)的更多相关文章

  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 ...

  2. 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 ...

  3. 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 ...

  4. 【模拟】 Codeforces Round #434 (Div. 1, based on Technocup 2018 Elimination Round 1) C. Tests Renumeration

    题意:有一堆数据,某些是样例数据(假设X个),某些是大数据(假设Y个),但这些数据文件的命名非常混乱.要你给它们一个一个地重命名,保证任意时刻没有重名文件的前提之下,使得样例数据命名为1~X,大数据命 ...

  5. Codeforces Round #440 (Div. 2, based on Technocup 2018 Elimination Round 2)

    A. Search for Pretty Integers 题目链接:http://codeforces.com/contest/872/problem/A 题目意思:题目很简单,找到一个数,组成这个 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. find_circ 识别circRNA 的原理

    find_circ 通过识别junction reads 来预测circRNA 和参考基因组比对完之后,首先剔除和基因组完全比对的reads,保留没比对上的reads, 这部分reads 直接比是比对 ...

  2. Python如何输出包含在对象中的中文字符?

    >>> bb = {'classes': ['\xe5\xb0\x96\xe6\xa4\x92\xe5\x9c\x9f\xe8\xb1\x86\xe4\xb8\x9d', '\xe5 ...

  3. CentOS下 Uptime 命令

    对于一些人来说系统运行了多久是无关紧要的,但是对于服务器管理员来说,这是相当重要的信息.服务器在运行重要应用的时候,必须尽量保证长时间的稳定运行,有时候甚至要求零宕机.那么我们怎么才能知道服务器运行了 ...

  4. 【转】struts2.5框架使用通配符指定方法(常见错误)

    在学习struts框架时经常会使用到通配符调用方法,如下: <package name="shop" namespace="/" extends=&quo ...

  5. [转]Git学习笔记与IntelliJ IDEA整合

    Git学习笔记与IntelliJ IDEA整合 一.Git学习笔记(基于Github) 1.安装和配置Git 下载地址:http://git-scm.com/downloads Git简要使用说明:h ...

  6. 关于Bundle

    1. 黄色的文件夹,打包的时候,不会建立目录,主要保存程序文件 - 素材不允许重名 2. 蓝色的文件夹,打包的时候,会建立目录,可以分目录的存储素材文件 - 素材可以重名 - 游戏的场景,backgr ...

  7. 第四章 事务(MYBatis)

    一个使用 MyBatis-Spring 的主要原因是它允许 MyBatis 参与到 Spring 的事务管理中.而不是给 MyBatis 创建一个新的特定的事务管理器,MyBatis-Spring 利 ...

  8. Unity文件操作路径

    Unity3D中的资源路径: Application.dataPath:此属性用于返回程序的数据文件所在文件夹的路径.例如在Editor中就是Assets了. Application.streamin ...

  9. 【Windows】win10应用商店被删后恢复方法!

    以管理员身份运行PowerShell,输入以下命令后回车(可直接复制粘贴): Get-AppxPackage -AllUsers| Foreach {Add-AppxPackage -DisableD ...

  10. COOKIE和SESSION关系和区别等

    一.cookie介绍 cookie 常用于识别用户.cookie 是服务器留在用户计算机中的小文件.每当相同的计算机通过浏览器请求页面时,它同时会发送 cookie.通过 PHP,您能够创建并取回 c ...