第一题水题,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. 《FTL之垃圾回收、写放大和OP 》总结

    来自 http://www.ssdfans.com/?p=1840: 写放大WA: 对空盘来说(未触发GC),写放大一般为1,即Host写入多少数据,SSD写入闪存也是多少数据量(这里忽略SSD内部数 ...

  2. 浅析selenium的PageFactory模式 PageFactory初始化pageobject

    1.首先介绍FindBy类: For example, these two annotations point to the same element: @FindBy(id = "foob ...

  3. Part01、sqlalchemy 使用

    一.ORM         连表               一对多               1.创建表,主动指定外键约束.               2.操作.                 ...

  4. android 弹出带按钮的对话框

    package com.example.helloworld; import android.os.Bundle;import android.app.Activity;import android. ...

  5. maven tomcat7-maven-plugin配置及背景

    背景: 在研发阶段,想让一个服务通过tomcat启动起来有很多的方法,常用的idea都有这样的支持,那么如果我们没有tomcat,能不能让服务通过tomcat启动起来呢?maven就提供了这样的支持. ...

  6. BZOJ 2599: [IOI2011]Race

    点分治,定权值,求另一关键字最小 不满足前缀加减性 可以按序遍历,用一数组$t[] 来维护路径为i的最小边数$ 再对于一个直系儿子对应的子树,先算距离求答案再更新$t数组,这样就不会重复$ #incl ...

  7. UVALive - 7740 Coding Contest 2016 青岛区域赛 (费用流)

    题意:每个点i有\(s_i\)个人和\(b_i\)份食物,每个人都要找到一份食物.现在有M条有向边,从点i到点j,容量为c,第一次走过不要紧,从第二次开始就要承担\(p(0<p<1)\)的 ...

  8. cmd中测试常用到的命令汇总

    1.最常用的 ping +ip 2.测试到远程服务器之间是否通的命令 telnet +ip +端口 3.路由跟踪,通过跟踪可以找到到哪地方不通 tracert ip      linux系统  tra ...

  9. 【Python】模块

    廖雪峰教程笔记. [使用模块有什么好处?] 1.使用模块可以避免函数名和变量名冲突. 2.大大提高了代码的可维护性. [使用模块的注意点] 1.每一个.py文件就是一个模块. 2.每一个包目录下面必须 ...

  10. JS类、对象、方法、prototype、_proto_

    案例代码: function People(name) { //对象属性 this.name = name; //对象方法 this.Introduce = function() { alert(&q ...