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 ...
随机推荐
- 如果参数是指针,且仅作输入用,则应在类型前加 const,以防止该 指针在函数体内被意外修改
如果参数是指针,且仅作输入用,则应在类型前加 const,以防止该 指针在函数体内被意外修改. #include <iostream> /* run this program using ...
- 【Java面试题】45 什么是java序列化,如何实现java序列化?或者请解释Serializable接口的作用。
我们有时候将一个java对象变成字节流的形式传出去或者从一个字节流中恢复成一个java对象,例如,要将java对象存储到硬盘或者传送给网络上的其他计算机,这个过程我们可以自己写代码去把一个java对象 ...
- datepicker防手动输入
在<input>中加入readonly="readonly"
- Android学习笔记——Menu(一)
背景: Android3.0(API level 11)开始,Android设备不再需要专门的菜单键. 随着这种变化,Android app应该取消对传统6项菜单的依赖.取而代之的是提供anction ...
- error MSB8031
http://go.microsoft.com/fwlink/p/?LinkId=286820 下载
- fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
解决方法:设置cpp文件的Precompiled Header属性设置为Not Using Precompiled Headers
- ssh在本地调用远程主机上的命令,不登录远程主机shell
需求描述: 在实际shell脚本的编写过程中,需要通过ssh远程执行一个命令,并返回执行的结果 简单来说,就是将命令发送到远程的主机上进行执行,但是并没有实际的登录到远程主机上.即通过 ssh的方式本 ...
- 如何使用CodeSmith批量生成代码(原创系列教程)
在上一篇我们已经用PowerDesigner创建好了需要的测试数据库,下面就可以开始用它完成批量代码生成的工作啦. 下面我会一步步的解释如何用CodeSmith实现预期的结果的,事先声明一下,在此只做 ...
- redis的初认识
Redis是一个开源,先进的key-value存储,并用于构建高性能,可扩展的Web应用程序的完美解决方案. Redis从它的许多竞争继承来的三个主要特点: Redis数据库完全在内存中,使用磁盘仅用 ...
- 用命令行执行ROBOT FRAMEWORK用例
转自:http://www.51testing.com/html/86/n-1430786.html 除了在ride中执行用例,我们也可以通过命令行的形式执行用例. 1.执行一整个项目 pybot+项 ...