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. react-native android app名字 app包名、图标和启动图片设置

    1.设置名字 打开 android/app/src/main/res/values/strings.xml 如图,进行修改即可 2.设置图标,最简单可以直接替换,其他后在看 在上图中几个文件夹中都有一 ...

  2. element 表格无法绑定服务返回数据

    无法直接绑定返回的Object属性,需要用js做一次对象转换后,才能绑定 <template> <div> <!--<button>添加服务器</but ...

  3. WPF按钮响应函数中执行操作耗时较长时,UI 界面不能实时更新——问题原因与解决方案

    原因: 一般来说,一个WPF窗口程序,只有一个UI线程, 如果这个线程停在某个函数,UI将会被阻塞,所有其他的界面操作都不能即时响应. 解决方案: 新开一个线程来执行耗时较长的操作,以不阻塞UI.

  4. Visual SVN Server备份脚本

    set tt=%date:~0,4%%date:~5,2%%date:~8,2% mkdir D:\SVN_BACKUP_%tt%\Repositories xcopy C:\Repositories ...

  5. unity Flash Animation Toolset插件使用

    插件网站:http://matov.me/flash-animation-toolset/ 1.在unity上打开资源商店,Window -> Asset Store -> 搜索Flash ...

  6. git release功能

    命令行: git tag -a v3. -m "这是4.0版本" git push origin v3. //git tag -a 标签名称 -m "说明" / ...

  7. Jquery select chosen 插件注意点

    <select style="width:200px;" name="carId" data-placeholder="选择车辆牌照" ...

  8. mysql分库分区分表

    分表: 分表分为水平分表和垂直分表. 水平分表原理: 分表策略通常是用户ID取模,如果不是整数,可以首先将其进行hash获取到整. 水平分表遇到的问题: 1. 跨表直接连接查询无法进行 2. 我们需要 ...

  9. 注解(Annotation)是什么?

  10. deb 和 rpm 后缀文件 区别和安装

    https://blog.csdn.net/u010977122/article/details/52986217 下载一个ATOM 的deb的安装包