Codeforces
来源:互联网 发布:淘宝双11海景房氛围图 编辑:程序博客网 时间:2024/06/16 08:47
A. The Useless Toy
题目链接
分类:模拟、map应用
1.题意概述
- 给你两个字符和旋转次数,问从第一个字符到第二个字符是通过顺时针还是逆时针旋转还是两种方向都行?
2.解题思路
- 考虑map映射4种状态,显然可以根据旋转的次数来确定它是否都能到达即可,具体细节参见代码。
3.AC代码
#include <bits/stdc++.h>using namespace std;#define lson root << 1#define rson root << 1 | 1#define lent (t[root].r - t[root].l + 1)#define lenl (t[lson].r - t[lson].l + 1)#define lenr (t[rson].r - t[rson].l + 1)#define eps 1e-6#define e exp(1.0)#define pi acos(-1.0)#define fi first#define se second#define pb push_back#define mp make_pair#define SZ(x) ((int)(x).size())#define All(x) (x).begin(),(x).end()#define rep(i,a,n) for (int i=a;i<n;i++)#define per(i,a,n) for (int i=n-1;i>=a;i--)#define Close() ios::sync_with_stdio(0),cin.tie(0)#define INF 0x3f3f3f3f#define maxn 1000010#define N 1111typedef vector<int> VI;typedef pair<int, int> PII;typedef long long ll;typedef unsigned long long ull;const int mod = 1e9 + 7;/* head */int main() {#ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); long _begin_time = clock();#endif char a, b; scanf("%c %c", &a, &b); map<char, int> mp; mp['^'] = 4; mp['v'] = 2; mp['<'] = 1; mp['>'] = 3; int n; scanf("%d", &n); n %= 4; if((n & 1) == 0) puts("undefined"); else if((mp[a] - mp[b] + 4) % 4 == n) puts("cw"); else puts("ccw");#ifndef ONLINE_JUDGE long _end_time = clock(); printf("time: %ld ms\n", _end_time - _begin_time);#endif return 0;}
阅读全文
0 0
- codeforces~~~
- Codeforces
- codeforces
- Codeforces
- codeforces
- codeforces
- Codeforces
- Codeforces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- 【HDU1722】Cake(gcd)
- git push 代码报错 Pushing to Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
- 数据挖掘岗位——工作准备
- java克隆技术
- Java NIO 阻塞式(block) 示例
- Codeforces
- Oracle-查询语句总结
- 设计模式之简单工厂模式
- linux安装图形界面
- 接入X5内核后出现32位无法在64位机器运行的问题(java.lang.reflect.InvocationTargetException; cause: java.lang.Unsatisfied)
- CentOS7安装Nginx
- [深度学习论文笔记][CVPR 17 Best Paper Honorable Mention] Annotating Object Instances with a Polygon-RNN
- tomcat 常见问题
- CISSP读书笔记-安全和风险管理-通过原则和策略的安全治理