Codeforces Beta Round #61 (Div. 2)

http://codeforces.com/contest/66

A

输入用long double

 #include<bits/stdc++.h>
using namespace std;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define sqr(x) ((x)*(x))
#define pb push_back
#define eb emplace_back
#define maxn 1000006
#define rep(k,i,j) for(int k=i;k<j;k++)
typedef long long ll;
typedef unsigned long long ull; int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
long double n;
cin>>n;
if(n>=-&&n<=) cout<<"byte"<<endl;
else if(n>=-&&n<=) cout<<"short"<<endl;
else if(n>=-&&n<=) cout<<"int"<<endl;
else if(n<) cout<<"long"<<endl;
else{
cout<<"BigInteger"<<endl;
}
}

B

暴力枚举每一个数即可

 #include<bits/stdc++.h>
using namespace std;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define sqr(x) ((x)*(x))
#define pb push_back
#define eb emplace_back
#define maxn 1000006
#define rep(k,i,j) for(int k=i;k<j;k++)
typedef long long ll;
typedef unsigned long long ull; int a[]; int main(){
#ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
int n;
cin>>n;
for(int i=;i<=n;i++){
cin>>a[i];
}
int ans=;
for(int i=;i<=n;i++){
int j=i-;
int co=;
while(j>=){
if(a[j+]>=a[j]){
j--;
co++;
}
else{
break;
}
}
j=i+;
while(j<=n){
if(a[j-]>=a[j]){
j++;
co++;
}
else{
break;
}
}
if(co>ans) ans=co;
}
cout<<ans<<endl;
}

C

模拟题

 #include<bits/stdc++.h>
using namespace std;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define sqr(x) ((x)*(x))
#define pb push_back
#define eb emplace_back
#define maxn 1000006
#define rep(k,i,j) for(int k=i;k<j;k++)
typedef long long ll;
typedef unsigned long long ull; string s,t;
int res1,res2;
map<string,int> M,N; int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
while(cin>>t)
{
s=t;
int F=;
while()
{
int x=s.find_last_of('\\');
if (x==) break;
s=s.substr(,x);
int f=N[s];
M[s]+=F;
N[s]++;
res1=max(res1,M[s]);
res2=max(res2,N[s]);
if (!f) F++;
}
}
cout<<res1<<' '<<res2<<endl;
}

D

找出3个数,使他们两两的公约数互不为1,他们三个的公约数为1,剩下的数就输出他们的倍数即可

 #include<bits/stdc++.h>
using namespace std;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define sqr(x) ((x)*(x))
#define pb push_back
#define eb emplace_back
#define maxn 1000006
#define rep(k,i,j) for(int k=i;k<j;k++)
typedef long long ll;
typedef unsigned long long ull; int a[]={,,}; int main(){
#ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
int n;
cin>>n;
if(n==){
cout<<-<<endl;
}
else{
for(int i=;i<n;i++){
if(i<){
cout<<a[i]<<endl;
}
else{
cout<<*i<<endl;
}
}
}
}

E

找出a[i]-b[i]前缀和的最小值,然后依次减去,如果发现minn大于等于0的情况,说明走的通,逆向同理

 #include<bits/stdc++.h>
using namespace std;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define sqr(x) ((x)*(x))
#define pb push_back
#define eb emplace_back
#define maxn 1000006
#define rep(k,i,j) for(int k=i;k<j;k++)
typedef long long ll;
typedef unsigned long long ull; int n;
int a[];
int b[];
set<int>se;
set<int>::iterator it; void func(int x){
int minn=a[]-b[],pre=minn;
for(int i=;i<n;i++){
pre+=a[i]-b[i];
minn=min(minn,pre);
}
for(int i=;i<n;i++){
if(minn>=){
if(x){
se.insert(i+);
}
else{
se.insert(n-i);
}
}
minn-=a[i]-b[i];
}
} int main(){
#ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
cin>>n;
rep(i,,n) cin>>a[i];
rep(i,,n) cin>>b[i];
func();
reverse(a,a+n);
reverse(b,b+n-);
func();
cout<<se.size()<<endl;
for(it=se.begin();it!=se.end();it++){
cout<<*it<<" ";
}
}

Codeforces Beta Round #61 (Div. 2)的更多相关文章

  1. Codeforces Beta Round #61 (Div. 2) D. Petya and His Friends 想法

    D. Petya and His Friends time limit per test 2 seconds memory limit per test 256 megabytes input sta ...

  2. Codeforces Beta Round #57 (Div. 2)

    Codeforces Beta Round #57 (Div. 2) http://codeforces.com/contest/61 A #include<bits/stdc++.h> ...

  3. Codeforces Beta Round #80 (Div. 2 Only)【ABCD】

    Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一 ...

  4. Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】

    Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...

  5. Codeforces Beta Round #79 (Div. 2 Only)

    Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...

  6. Codeforces Beta Round #77 (Div. 2 Only)

    Codeforces Beta Round #77 (Div. 2 Only) http://codeforces.com/contest/96 A #include<bits/stdc++.h ...

  7. Codeforces Beta Round #76 (Div. 2 Only)

    Codeforces Beta Round #76 (Div. 2 Only) http://codeforces.com/contest/94 A #include<bits/stdc++.h ...

  8. Codeforces Beta Round #75 (Div. 2 Only)

    Codeforces Beta Round #75 (Div. 2 Only) http://codeforces.com/contest/92 A #include<iostream> ...

  9. Codeforces Beta Round #74 (Div. 2 Only)

    Codeforces Beta Round #74 (Div. 2 Only) http://codeforces.com/contest/90 A #include<iostream> ...

随机推荐

  1. python内置函数使用

    print(abs(1)) #绝对值,正数就是自己 ",''])) #计算可迭代对象中是否为真,其中一个为假,就显示为假 print(all('')) # If the iterable i ...

  2. 选择、操作web元素-2

    11月3日 等待web元素的出现 例子:百度搜索松勤网,点击操作后不等待页面刷新,下面选择页面元素的时候,该元素还是未出现 sleep方案的弊病:固定的等待时间,导致测试用例执行时间很长 为什么cli ...

  3. WDA-Web Dynpro的POWL(个人对象工作清单)

    POWL(Personal Object Worklist) for Web Dynpro 转载地址:https://blogs.sap.com/2013/02/15/powlpersonal-obj ...

  4. Java继承与多态浅析

    一.继承 1.通过extends继承的父类可以是不加abstract关键字的普通类,也可以是加了abstract关键字的抽象类.继承普通类时可以覆写父类的方法,或者创建自己独有的方法,或者这两     ...

  5. 10:处理 json

    json 通用的数据类型, 所有的语言都认识.json 是字符串.key-value 必须使用双引号1. loads() 和 dumps() 的使用 json.loads() 将 json 字符串转换 ...

  6. Bash 翻译

    Bash参考手册 目录 1简介 1.1什么是Bash? 1.2什么是shell? 2定义 3基本外壳功能 3.1 Shell语法 3.1.1外壳操作 3.1.2报价 3.1.2.1逃逸角色 3.1.2 ...

  7. getVisibleSize,getWinSize,getFrameSize,getViewPortRect

    cc.director.getVisibleSize();//获取运行场景的可见大小 cc.director.getWinSize();//获取视图的大小,以点为单位 cc.director.getW ...

  8. 一个linux内核模块移植到低版本时发生的异常

    在3.10的内核版本下,有一个运行稳定的内核模块,移植到suse11的时候,编译正常,运行则直接出现crash: <>[ <>[ 503.347300] Modules lin ...

  9. win 2012 安装mysql 5.7.20 及报错 This application requires Visual Studio 2013 Redistributable. Please install the Redistributable then run this installer again 的解决办法

    本文地址:http://www.cnblogs.com/jying/p/7764147.html    转载请注明出处. 安装过程其实挺简单,基本上下一步下一步,可以参考我的另一篇mysql安装文章: ...

  10. 面试官提出的问题应该怎么答?(如开发中使用过EasyUI吗?)

    Jquery EasyUI是第三方基于Jquery框架开发的一款轻量级的,侧重于页面显示部分的框架,也可以称为插件. Jquery EasyUI使用比较简单,也有比较全的文档可供参考. 常用的组件就是 ...