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

题意:给定4个图标,某些图标经过顺时针/逆时针旋转90°后能得到另外一些图标。现在给你开始的图标和结束的图标,还有旋转的次数n。问你开始图标经过n次旋转后得到结束图标的旋转方向是顺时针还是逆时针还是无法确定。

思路:水题,可以发现每个图标经过4次旋转后(顺/逆时针一样)会回到原来的位置,那么我们先对n%4,然后就可以暴力枚举(枚举次数<4)顺时针和逆时针得到的结果了。然后和结束图标来匹配最终确定旋转方向。

#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<time.h>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long int LL;
const int MAXN = 1e5 + ;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + ;
char cw[];
int main(){
#ifdef kirito
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
char c1[],c2[]; int n;
cw[] = 'v'; cw[] = '<'; cw[] = '^'; cw[] = '>';
while (~scanf("%s %s", c1,c2)){
scanf("%d", &n); n %= ;
int res = -,cnt=;
for (int i = ,j,k; i <= ; i++){
if (c1[] == cw[i]){
for (k = , j = i; k <= n; k++, j = (j + == ? : j + )){ }
if (c2[] == cw[j]){
res = ; cnt++;
}
break;
}
}
for (int i = ,j,k; i >= ; i--){
if (c1[] == cw[i]){
for (k = , j = i; k <= n; k++, j = (j - == - ? : j - )){}
if (c2[] == cw[j]){
res = ; cnt++;
}
break;
}
}
if (res == &&cnt==){
printf("cw\n");
}
else if (res == &&cnt==){
printf("ccw\n");
}
else{
printf("undefined \n");
}
}
return ;
}

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

  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 思路: 水题 实现代码: #include<bits/st ...

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

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

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

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

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

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

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

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

随机推荐

  1. OpenCV Machine Learning (C++)

    /*M/////////////////////////////////////////////////////////////////////////////////////////// IMPOR ...

  2. vue路由实例

    router.js: import Vue from 'vue' import Router from 'vue-router' import Home from '@/components/Home ...

  3. JavaScript method overload

     https://stackoverflow.com/questions/2187666/help-with-js-and-functions-parameters JavaScript doesn' ...

  4. release,debug库互调用,32位,64位程序与库互调用

    以下是基于visual studio 2015和cmake的实验 1,debug或release的应用程序都可以调用release的库2,win32和x64的应用和库无法互调用,在VS中链接时会有一堆 ...

  5. 网络流小记(EK&dinic&当前弧优化&费用流)

    欢 迎 来 到 网 络 瘤 的 世 界 什么是网络流? 现在我们有一座水库,周围有n个村庄,每个村庄都需要水,所以会修水管(每个水管都有一定的容量,流过的水量不能超过容量).最终水一定会流向唯一一个废 ...

  6. python 卡方检验例子

    python 求拒绝域和卡方值 import scipy.stats as ss obs=[107,198,192,125,132,248] exp=[167]*6 #拒绝域 1%的显著水平,自由度5 ...

  7. Delphi XE2 之 FireMonkey 入门(18) - TLang(多语言切换的实现)

    一个小小的 TLang 类, 实现多语言切换, 挺好的. 它的工作思路是: 1.首先通过 AddLang('语言代码') 添加语言类别, 如: AddLang('en').AddLang('cn'). ...

  8. 测开之路一百一十三:bootstrap媒体对象

    实现效果,左边是图片或者其他媒体,右边是对应的描述 引入bootstrap和jquery标签 class="media" 数量多一些看着就会很规整 <!DOCTYPE htm ...

  9. jmeter之关联操作

    测试接口过程中,常常会遇到这样的一个情况:上一个请求返回的数据,另外一个接口需要要使用.那么,使用Jmeter操作时我们常常可以用“关联”来实现. 以接口“登录”和“金币充值”为例:即在做“金币充值” ...

  10. list数据的存储

    1 存储成csv格式 简单方法: a = [3,3,4,4] df = {'a': a} df = pd.DataFrame(df) df.to_csv('./a.csv') 复杂方法: import ...