【Codeforces Round #426 (Div. 2) A】The Useless Toy
【Link】:http://codeforces.com/contest/834/problem/A
【Description】
【Solution】
开个大小为4的常量字符数组;
+n然后余4,-n然后余4;
相同位置就不行;
否则
判断是哪一种方式到最后一个字符
(没有非法的情况,所以不用考虑两种方式都不是,可以看题目描述有说)
【NumberOf WA】
【Reviw】
【Code】
#include <bits/stdc++.h>
using namespace std;
#define int long long
const char temp[4] = {'v','<','^','>'};
char be[3],en[3];
int n;
main(){
scanf("%s%s",be,en);
scanf("%lld",&n);
for (int i = 0;i <= 3;i++)
if (temp[i]==be[0]){
int cw = (i + n)%4;
int ccw = ((i-n)%4+4)%4;
if (cw==ccw){
return puts("undefined"),0;
}
if (temp[cw]==en[0]){
return puts("cw"),0;
}
if (temp[ccw]==en[0]){
return puts("ccw"),0;
}
puts("undefined");
break;
}
return 0;
}
【Codeforces Round #426 (Div. 2) A】The Useless Toy的更多相关文章
- 【Codeforces Round #426 (Div. 2) B】The Festive Evening
[Link]:http://codeforces.com/contest/834/problem/B [Description] [Solution] 模拟水题; 注意一个字母单个出现的时候,结束和开 ...
- 【Codeforces Round #426 (Div. 2) C】The Meaningless Game
[Link]:http://codeforces.com/contest/834/problem/C [Description] 有一个两人游戏游戏; 游戏包括多轮,每一轮都有一个数字k,赢的人把自己 ...
- 【Codeforces Round #432 (Div. 1) B】Arpa and a list of numbers
[链接]h在这里写链接 [题意] 定义bad list是一个非空的.最大公约数为1的序列.给定一个序列,有两种操作:花费x将一个元素删除.花费y将一个元素加1,问你将这个序列变为good list所需 ...
- 【Codeforces Round #420 (Div. 2) C】Okabe and Boxes
[题目链接]:http://codeforces.com/contest/821/problem/C [题意] 给你2*n个操作; 包括把1..n中的某一个数压入栈顶,以及把栈顶元素弹出; 保证压入和 ...
- 【Codeforces Round #420 (Div. 2) B】Okabe and Banana Trees
[题目链接]:http://codeforces.com/contest/821/problem/B [题意] 当(x,y)这个坐标中,x和y都为整数的时候; 这个坐标上会有x+y根香蕉; 然后给你一 ...
- 【Codeforces Round #420 (Div. 2) A】Okabe and Future Gadget Laboratory
[题目链接]:http://codeforces.com/contest/821/problem/A [题意] 给你一个n*n的数组; 然后问你,是不是每个位置(x,y); 都能找到一个同一行的元素q ...
- 【Codeforces Round #423 (Div. 2) C】String Reconstruction
[Link]:http://codeforces.com/contest/828/problem/C [Description] 让你猜一个字符串原来是什么; 你知道这个字符串的n个子串; 且知道第i ...
- 【Codeforces Round #423 (Div. 2) B】Black Square
[Link]:http://codeforces.com/contest/828/problem/B [Description] 给你一个n*m的格子; 里面包含B和W两种颜色的格子; 让你在这个格子 ...
- 【Codeforces Round #423 (Div. 2) A】Restaurant Tables
[Link]:http://codeforces.com/contest/828/problem/A [Description] 有n个组按照时间顺序来餐馆; 每个组由一个人或两个人组成; 每当有一个 ...
随机推荐
- git rebase 的使用 (用于撤销某次commit)
Q: I wrote the wrong thing in a commit message. Alternatively, I've forgotten to include some files. ...
- BZOJ3744 Gty的妹子序列(分块+树状数组)
题意 询问区间内逆序对数 强制在线 1<=n<=50000 1<=m<=50000 题解 两个预处理f[i][j]为块i到j的逆序对数,s[i][j]前i块≤j的有多少个边角 ...
- 紫书 例题 10-25 UVa 1363(找规律)
可以发现余数是成一段一段的等差数列的. 在商数同的时候,余数是成首项为第一个数的余数,公差 为商数的等差数列. 利用这个性质求解即可. #include<cstdio> #include& ...
- Unity C# 设计模式(六)原型模式
定义:用原型实例指定创建对象的种类,并通过拷贝这些原型来创建新的对象. 优点: 1.原型模式向客户隐藏了创建新实例的复杂性 2.原型模式允许动态增加或较少产品类. 3.原型模式简化了实例的创建结构,工 ...
- 【codeforces 821E】Okabe and El Psy Kongroo
[题目链接]:http://codeforces.com/problemset/problem/821/E [题意] 一开始位于(0,0)的位置; 然后你每次可以往右上,右,右下3走一步; (x+1, ...
- What is x86 Conforming Code Segment?
SRC=Microprocessor Based Systems SRC=Computer Architecture: A Quantitative Approach
- BestCoder Round #11 (Div. 2)
太菜,仅仅能去Div2.(都做不完 ORZ... 各自是 HDU: 5054pid=5054"> Alice and Bob 5055Bob and math problem 5056 ...
- ios提交程序后出现的各种问题
提交了几次都被feedback.下面均为本人碰到过得问题.希望对大家解决提交问题有帮助 Number one:PLA 3.3.12 We found your app uses the iOS ...
- Install Qt 5 on Ubuntu(使用qt-opensource-linux-x64-5.7.0.run进行安装,而且是官方的wiki)
Introduction This is a tutorial for installation of Qt 5.7.0 to Ubuntu 12.10. It may be used also fo ...
- poj--1637--Sightseeing tour(网络流,最大流判断混合图是否存在欧拉图)
Sightseeing tour Time Limit: 1000MS Memory Limit: 10000KB 64bit IO Format: %I64d & %I64u Sub ...