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. 利用STM32CubeMX生成HID双向通讯工程

    使用开发板为正点原子ministm32 现在我们先使用HID descriptor Tool来生成我们需要的hid的 保存使用选择.H // D:\usb资料\HID\MSDEV\Projects\t ...

  2. Django 之多表查询 与多表的使用

    1.django的多表查询 主要区分为: 正向查询    逆向查询 1. 多表查询: 是一个复杂的查询,他分为对象查询和__模糊查询两种方式 2. 多表查询: 又分为 一对一查询, 一对多查询, 多对 ...

  3. uiautomator:Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!

    尝试用android sdk的uiautomatorviewer抓元素的时候报错:Error while obtaining UI hierarchy XML file: com.android.dd ...

  4. day15-函数进阶

    1.函数嵌套 多个函数嵌套在一起即为函数嵌套 在调用函数时,函数需在调用之前定义,如果函数在调用之后才定义,则不能被成功调用.当定义多个函数时,函数名称不能相同,否则后定义的函数会将之前的函数覆盖,即 ...

  5. dshow采集过程

    捕捉静态图片常用的filter是Sample Graber filter,它的用法参考手册.然后将捕捉filter的静态PIN连接到Sample Grabber,再将Sample Grabber连接到 ...

  6. jq时间戳动画

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  7. Servlet基本_サーブレットのライフサイクル、スレッドセーフ

    1.サーブレットのライフサイクル初期化時 ⇒ init() [初回リクエスト時] ↓リクエスト時 ⇒service() ⇒doGet() [Httpリクエストメソッドにより振り分け] 或は⇒doPos ...

  8. MySQL大数据量分页查询方法及其优化

    MySQL大数据量分页查询方法及其优化   ---方法1: 直接使用数据库提供的SQL语句---语句样式: MySQL中,可用如下方法: SELECT * FROM 表名称 LIMIT M,N---适 ...

  9. 25. IO流.md

    目录 IO分类: 1.FIle类 1.1目录分隔符 1.2常用方法 2.FileInputStream类 2.1读取文件 3.FileOutputStream类 拷贝文件 4.缓冲流 4.1 Buff ...

  10. SQL Server GROUP BY 后 拼接 字符串

    原文地址:https://blog.csdn.net/u010673842/article/details/79637618 select ID, ,,'') from class a group b ...