CodeForces 834A The Useless Toy
来源:互联网 发布:大连知行科技有限公司 编辑:程序博客网 时间:2024/05/21 17:51
题目链接:http://codeforces.com/contest/834/problem/A
题意:有v,<,^,>,四个符号,分别由v顺时针旋转90度依次得到,现在告诉你其实符号,和结束符号,需要经过n次选择,问你是顺时针旋转获得,还是逆时针旋转获得,亦或是顺时针或逆时针旋转都能获得
解析:反正是一个为4的循环节,取一下模就出来了
#include <bits/stdc++.h>using namespace std;const int maxn = 1e5+100;char a[] = {'v','<','^','>'};int main(void){ char t1,t2; cin>>t1>>t2; int pos,n; cin>>n; for(int i=0;i<4;i++) { if(a[i]==t1) { pos = i; break; } } int tt = n%4; int a1 = (tt+pos)%4,a2 = (pos-tt+4)%4; if(a[a1]==t2 && a1 != a2) puts("cw"); else if(a[a2]==t2 && a1 != a2) puts("ccw"); else puts("undefined"); return 0;}
阅读全文
0 0
- Codeforces 834A-The Useless Toy
- Codeforces 834 A The Useless Toy
- CodeForces 834A The Useless Toy
- codeforces 834-A. The Useless Toy
- codeforces 834A The Useless Toy
- 【CodeForces】834A The Useless Toy 水
- 834A. The Useless Toy
- CodeForces 834 A.The Useless Toy(水~)
- 【CodeForces】426Div2 A The Useless Toy
- Codeforces 843A:The Useless Toy
- A. The Useless Toy
- A. The Useless Toy
- CF 834A-The Useless Toy
- Codeforces Round #426 (Div. 2) A. The Useless Toy
- Codeforces Round #426 (Div. 2)-A. The Useless Toy
- Codeforces Round #426 (Div. 2) A The Useless Toy
- (模拟)Codeforces Round #426 A. The Useless Toy
- Codeforces Round #426 (Div. 2) A. The Useless Toy
- iOS字符串的拆分
- 【一头扎进JMS】(5)----搭建RabbitMQ环境
- HDU 2017 多校联合训练赛2 1009 6053 TrickGCD 莫比乌斯函数
- 素数环
- Tomcat注册服务总结
- CodeForces 834A The Useless Toy
- Properties类的用法总结
- Python yield 使用浅析
- iOS音频播放 (五):AudioQueue
- Unity3d学习笔记
- c++友元函数
- Android 和 Dagger 2 中的依赖注入
- HDU1323 Prefection
- C++ 红黑树 (附带调试工具)