第一题水题,8分钟1a

#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f3f; int main()
{
ios::sync_with_stdio(false);
cin.tie();
int n;
cin>>n;
int last;
bool maybe=,rate=;
for(int i=;i<n;i++)
{
int a,b;
cin>>a>>b;
if(i==)last=a;
else
{
if(last<a)maybe=;
last=a;
}
if(a!=b)rate=;
}
if(rate)cout<<"rated"<<endl;
else if(!rate&&maybe)cout<<"unrated"<<endl;
else if(!rate&&!maybe)cout<<"maybe"<<endl;
return ;
}

A

第二题暴力模拟一下,每次加(减)50,先减再加

#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f3f; int main()
{
ios::sync_with_stdio(false);
cin.tie();
int p,x,y,ans=;
cin>>p>>x>>y;
for(int i=x;i>=y;i-=)
{
int j=(i/)%;
for(int k=;k<=;k++)
{
j=(j*+)%;
if(j+==p)
{
ans=i;
break;
}
}
if(ans)break;
}
if(ans)
{
cout<<<<endl;
return ;
}
for(int i=x;;i+=)
{
int j=(i/)%;
for(int k=;k<=;k++)
{
j=(j*+)%;
if(j+==p)
{
ans=i;
break;
}
}
if(ans)break;
}
int res=(ans-x+)/;
cout<<res<<endl;
return ;
}

B

第三题wa了6发,终于O(1)过了,数据1e9早该想到算法有问题

#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f3f; int main()
{
ios::sync_with_stdio(false);
cin.tie();
ll x,y,p,q;
int t;
cin>>t;
while(t--){
cin>>x>>y>>p>>q;
if(p==q)
{
if(x==y)cout<<<<endl;
else cout<<-<<endl;
continue;
}
if(p==)
{
if(x==)cout<<<<endl;
else cout<<-<<endl;
continue;
}
ll k1=(y-x)/(q-p);
if((y-x)%(q-p)!=)k1++;
ll k2=x/p;
if(x%p!=)k2++;
ll k3=y/q;
if(y%q!=)k3++;
ll k=max(k1,max(k2,k3));
cout<<k*q-y<<endl;
}
return ;
}

C

Codeforces Round #412的更多相关文章

  1. Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3)(A.B.C,3道暴力题,C可二分求解)

    A. Is it rated? time limit per test:2 seconds memory limit per test:256 megabytes input:standard inp ...

  2. Codeforces Round#412 Div.2

    A. Is it rated? 题面 Is it rated? Here it is. The Ultimate Question of Competitive Programming, Codefo ...

  3. Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3) A B C D 水 模拟 二分 贪心

    A. Is it rated? time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  4. Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3) D - Dynamic Problem Scoring

    地址:http://codeforces.com/contest/807/problem/D 题目: D. Dynamic Problem Scoring time limit per test 2 ...

  5. Codeforces Round #412 A Is it rated ?

    A. Is it rated? time limit per test  2 seconds memory limit per test  256 megabytes Is it rated? Her ...

  6. Codeforces Round #412 Div. 2 第一场翻水水

    大半夜呆在机房做题,我只感觉智商严重下降,今天我脑子可能不太正常 A. Is it rated? time limit per test 2 seconds memory limit per test ...

  7. Codeforces Round #412 Div. 2 补题 D. Dynamic Problem Scoring

    D. Dynamic Problem Scoring time limit per test 2 seconds memory limit per test 256 megabytes input s ...

  8. Codeforces Round #412 B. T-Shirt Hunt

    B. T-Shirt Hunt time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  9. Codeforces Round #412 C. Success Rate

    C. Success Rate time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  10. Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3) A Is it rated?

    地址:http://codeforces.com/contest/807/problem/C 题目: C. Success Rate time limit per test 2 seconds mem ...

随机推荐

  1. ORACLE USERENV函数

    ORACLE USERENV函数 USERENV返回关于当前会话的信息.此信息可以用于编写一个应用程序特定的审计跟踪表或确定特定于语言的角色目前使用的会话. 参数 功能 CLINET_INFO 返回最 ...

  2. 基于java的网络爬虫框架(实现京东数据的爬取,并将插入数据库)

    原文地址http://blog.csdn.net/qy20115549/article/details/52203722 本文为原创博客,仅供技术学习使用.未经允许,禁止将其复制下来上传到百度文库等平 ...

  3. Vim插件:Unite新手指导(译)

    Unite是什么? Unite可以在一个项目中快速浏览文件.但是它不仅限于文件,其他任何可以列出的东西都可以很好的被显示和搜索.这个开放式的特性很可能是人们找到它的原因(原文:This open-en ...

  4. SQL Server扩展属性的增、删、改、查

    使用 sql 语句创建表时,可以使用系统存储过程 sp_addextendedproperty 给字段添加描述说明. sp_addextendedproperty 语法: sp_addextended ...

  5. Springboot 日志管理配置logback-spring.xml

    几种常见的日志 Log4j:是最早的日志框架,是apach旗下的,可以单独使用,也可配合日志框架JCL使用: Log4j2:apach旗下的关于log4j的升级版: Logback:是基于slf4j接 ...

  6. java的接口为什么不能实例化

    java的接口为什么不能实例化呢?首先,我们需要明白实例化的含义.实例化实际意义是在jvm的堆中开辟出一块内存空间,比如Student s = new Student();此处声明Student对象s ...

  7. 什么是Java中的原子操作( atomic operations)

    1.啥是java的原子性 原子性:即一个操作或者多个操作 要么全部执行并且执行的过程不会被任何因素打断,要么就都不执行. 一个很经典的例子就是银行账户转账问题: 比如从账户A向账户B转1000元,那么 ...

  8. git 提交和下载代码

    在github下需先 New repository 下载:进入程序工程目录下 如 cd f: cd ./Program\ Files/eclipse/workspace/IMoocMusic/ git ...

  9. Ubuntu安装samba实现文件夹共享

    因工作需要,准备在Ubuntu服务器上共享文件夹,从Windows和Mac上都可以访问共享文件. 搜了一下,决定通过samba服务实现.安装过程如下: [step1]安装samba服务 sudo ap ...

  10. 【DeepLearning学习笔记】Neurons神经元

    今天找到一个比较好的deep learning的教材:Neural Networks and Deep Learning 对神经网络有详细的讲解,鉴于自己青年痴呆,还是总结下笔记吧=.= Percep ...