A. The Useless Toy

题目链接:http://codeforces.com/contest/834/problem/A

思路: 水题

实现代码:

#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<list>
using namespace std;
#define ll long long
#define sd(x) scanf("%d",&x)
#define sdd(x,y) scanf("%d%d",&x,&y)
#define sddd(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define sf(x) scanf("%s",x)
#define ff(i,x,y) for(int i = x;i <= y;i ++)
#define fj(i,x,y) for(int i = x;i >= y;i --)
#define mem(s,x) memset(s,x,sizeof(s));
#define pr(x) printf("%d",x);
const int Mod = 1e9+;
const int inf = 1e9;
const int Max = 1e5+;
void exgcd(ll a,ll b,ll& d,ll& x,ll& y){if(!b){d=a;x=;y=;}else{exgcd(b,a%b,d,y,x);y-=x*(a/b);}}
ll inv(ll a,ll n){ll d, x, y;exgcd(a,n,d,x,y);return (x+n)%n;}
int gcd(int a,int b) { return (b>)?gcd(b,a%b):a; }
int lcm(int a, int b) { return a*b/gcd(a, b); }
ll mod(ll x,ll y){
return x-(x/y)*y;
}
int main()
{
ios::sync_with_stdio();
cin.tie();
char a[];
ll k,b[];
cin>>a[]>>a[];
cin>>k;
for(int i=;i<=;i++){
if(a[i]=='v') b[i] = ;
if(a[i]=='<') b[i] = ;
if(a[i]=='^') b[i] = ;
if(a[i]=='>') b[i] = ;
}
ll ans1 = mod(k+b[],);
ll ans2 = mod(b[]-k,);
while(ans2<)
ans2+=;
if(b[]==ans1&&b[]==ans2)
cout<<"undefined"<<endl;
else if(b[]==ans2)
cout<<"ccw"<<endl;
else if(b[]==ans1)
cout<<"cw"<<endl;
return ;
}

B. The Festive Evening

题目链接:http://codeforces.com/contest/834/problem/B

思路; 水题

实现代码:

#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<list>
using namespace std;
#define ll long long
#define sd(x) scanf("%d",&x)
#define sdd(x,y) scanf("%d%d",&x,&y)
#define sddd(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define sf(x) scanf("%s",x)
#define ff(i,x,y) for(int i = x;i <= y;i ++)
#define fj(i,x,y) for(int i = x;i >= y;i --)
#define mem(s,x) memset(s,x,sizeof(s));
#define pr(x) printf("%d",x);
const int Mod = 1e9+;
const int inf = 1e9;
const int Max = 1e5+;
void exgcd(ll a,ll b,ll& d,ll& x,ll& y){if(!b){d=a;x=;y=;}else{exgcd(b,a%b,d,y,x);y-=x*(a/b);}}
ll inv(ll a,ll n){ll d, x, y;exgcd(a,n,d,x,y);return (x+n)%n;}
int gcd(int a,int b) { return (b>)?gcd(b,a%b):a; }
int lcm(int a, int b) { return a*b/gcd(a, b); }
ll mod(ll x,ll y){ return x-(x/y)*y;}
char s[];
map<char,int>mp;
set<char>st;
int main()
{
int n,m,cnt=,i,vis[];
ios::sync_with_stdio();
cin.tie();
cin>>n>>m;
mp.size();
for(i=;i<n;i++){
cin>>s[i];
mp[s[i]]=i;
}
for(i=;i<n-;i++){
st.insert(s[i]);
if(st.size()>m){
cout<<"YES"<<endl;
return ;
}
if(mp[s[i]]==i)
st.erase(s[i]);
}
cout<<"NO"<<endl;
return ;
}

C. The Meaningless Game

题目链接:http://codeforces.com/contest/834/problem/C

思路:二分,a,b分别*k或*k^2,那么a*b必为k*(k^2)*(k1^2)*k1*.....也就是 (k*k1*..)^3,直接二分搜a*b是否为某个数的三次方,输入输出数据比较大,用scanf和print.要不超时

实现代码:

#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<list>
using namespace std;
#define ll long long
#define sd(x) scanf("%d",&x)
#define sdd(x,y) scanf("%d%d",&x,&y)
#define sddd(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define sf(x) scanf("%s",x)
#define ff(i,x,y) for(int i = x;i <= y;i ++)
#define fj(i,x,y) for(int i = x;i >= y;i --)
#define mem(s,x) memset(s,x,sizeof(s));
#define pr(x) printf("%d",x);
const int Mod = 1e9+;
const int inf = 1e9;
const int Max = 1e5+;
void exgcd(ll a,ll b,ll& d,ll& x,ll& y){if(!b){d=a;x=;y=;}else{exgcd(b,a%b,d,y,x);y-=x*(a/b);}}
ll inv(ll a,ll n){ll d, x, y;exgcd(a,n,d,x,y);return (x+n)%n;}
int gcd(int a,int b) { return (b>)?gcd(b,a%b):a; }
int lcm(int a, int b) { return a*b/gcd(a, b); }
int main()
{
ll n,i,mid,l,r,a,b;
cin>>n;
for(i=;i<n;i++){
scanf("%I64d %I64d",&a,&b);
l=;r=;
int flag = ;
while(l<=r){
mid = (l+r)/;
//cout<<Pow(mid,3)<<" "<<a*b<<endl;
if(mid*mid*mid==a*b){
flag = ;break;}
if(mid*mid*mid>a*b)
r = mid-;
if(mid*mid*mid<a*b)
l = mid+;
}
if(flag&&a*a%b==&&b*b%a==)
printf("Yes\n");
else
printf("No\n");
}
return ;
}

Codeforces Round #426 (Div. 2) A,B,C的更多相关文章

  1. CodeForces 834C - The Meaningless Game | Codeforces Round #426 (Div. 2)

    /* CodeForces 834C - The Meaningless Game [ 分析,数学 ] | Codeforces Round #426 (Div. 2) 题意: 一对数字 a,b 能不 ...

  2. Codeforces Round #426 (Div. 2)【A.枚举,B.思维,C,二分+数学】

    A. The Useless Toy time limit per test:1 second memory limit per test:256 megabytes input:standard i ...

  3. Codeforces Round #426 (Div. 2)

    http://codeforces.com/contest/834 A. The Useless Toy 题意: <,>,^,v这4个箭头符号,每一个都可以通过其他及其本身逆时针或者顺时针 ...

  4. Codeforces Round #426 (Div. 2) C. The Meaningless Game

    C. The Meaningless Game 题意: 两个人刚刚开始游戏的时候的分数, 都是一分, 然后随机一个人的分数扩大k倍,另一个扩大k的平方倍, 问给你一组最后得分,问能不能通过游戏得到这样 ...

  5. Codeforces Round #426 (Div. 2)A B C题+赛后小结

    最近比赛有点多,可是好像每场比赛都是被虐,单纯磨砺心态的作用.最近讲的内容也有点多,即便是点到为止很浅显的版块,刷了专题之后的状态还是~"咦,能做,可是并没有把握能A啊".每场网络 ...

  6. Codeforces Round #426 (Div. 2)A题&&B题&&C题

    A. The Useless Toy:http://codeforces.com/contest/834/problem/A 题目意思:给你两个字符,还有一个n,问你旋转n次以后从字符a变成b,是顺时 ...

  7. 【Codeforces Round #426 (Div. 2) A】The Useless Toy

    [Link]:http://codeforces.com/contest/834/problem/A [Description] [Solution] 开个大小为4的常量字符数组; +n然后余4,-n ...

  8. 【Codeforces Round #426 (Div. 2) B】The Festive Evening

    [Link]:http://codeforces.com/contest/834/problem/B [Description] [Solution] 模拟水题; 注意一个字母单个出现的时候,结束和开 ...

  9. 【Codeforces Round #426 (Div. 2) C】The Meaningless Game

    [Link]:http://codeforces.com/contest/834/problem/C [Description] 有一个两人游戏游戏; 游戏包括多轮,每一轮都有一个数字k,赢的人把自己 ...

随机推荐

  1. React-将元素渲染到 DOM 中

    首先我们在一个 HTML 页面中添加一个 id="root" 的 <div>,在此 div 中的所有内容都将由 React DOM 来管理,所以我们将其称之为 “根” ...

  2. jQuery webcam plugin

    jQuery webcam plugin The jQuery webcam plugin is a transparent layer to communicate with a camera di ...

  3. Ionic Android项目Splash设置

    ionic项目中,在splashscreen消失后会出现零点几秒的白屏,再出现app页面. 1. 安装Cordova splash screen插件 ionic plugin add org.apac ...

  4. zuul简单使用

    zuul路由的几个配置参数1.静态路由 zuul: routes: myroute1: path: /mypath/** url: http://localhost:8080 (注意这里url要htt ...

  5. 【SDOI2017】数字表格

    题面 题解 这道题目还有一种比较有意思的解法. 定义一种运算\((\mathbf f\oplus\mathbf g)(x) = \prod\limits_{d\mid x}\mathbf f(d)^{ ...

  6. xml解析 使用dom4j操作xml

     使用dom4j操作xml 1 导入 dom4j,的jar包   2 指定要解析的XML文件 SAXReader sr=new SAXReader(); Document document= sr.r ...

  7. SqlServer 案例:已有汽车每日行驶里程数据,计算其每日增量

    需求说明 某公司某项业务,需要获得用户每日行车里程数.已知能获得该车每日提交的总里程数,如何通过 T-SQL 来获得其每日增量里程? 解决方案 首选需要对数据进行编号,利用开窗函数 OVER() 实现 ...

  8. Effective C++学习笔记之#define

    前言 条款02:尽量以const.enum.inline替换#define:尽可能用编译器代替不必要的预处理器. 内容 一.对于单纯常量 1.const 有两种特殊的const,常量指针和class专 ...

  9. Docker容器学习梳理 - 容器硬盘热扩容

    前面已介绍了docker很多知识点的操作记录,今天这里梳理下docker容器空间扩展的操作.默认情况下,物理机下创建的docker容器的空间是10G(虚拟机下创建的docker容器空间就是虚拟机的空间 ...

  10. iOS实时查看App运行日志

    前言: 本文讨论如何实时查看输出在console控制台的日志. 一.Xcode 通过Window->Devices打开devices界面,选择我们的手机,也能看到手机中运行的进程输出的日志.如图 ...