Codeforces Round #426 (Div. 2) - A
题目链接: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的更多相关文章
- CodeForces 834C - The Meaningless Game | Codeforces Round #426 (Div. 2)
/* CodeForces 834C - The Meaningless Game [ 分析,数学 ] | Codeforces Round #426 (Div. 2) 题意: 一对数字 a,b 能不 ...
- 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 ...
- Codeforces Round #426 (Div. 2)
http://codeforces.com/contest/834 A. The Useless Toy 题意: <,>,^,v这4个箭头符号,每一个都可以通过其他及其本身逆时针或者顺时针 ...
- Codeforces Round #426 (Div. 2) C. The Meaningless Game
C. The Meaningless Game 题意: 两个人刚刚开始游戏的时候的分数, 都是一分, 然后随机一个人的分数扩大k倍,另一个扩大k的平方倍, 问给你一组最后得分,问能不能通过游戏得到这样 ...
- Codeforces Round #426 (Div. 2)A B C题+赛后小结
最近比赛有点多,可是好像每场比赛都是被虐,单纯磨砺心态的作用.最近讲的内容也有点多,即便是点到为止很浅显的版块,刷了专题之后的状态还是~"咦,能做,可是并没有把握能A啊".每场网络 ...
- Codeforces Round #426 (Div. 2) A,B,C
A. The Useless Toy 题目链接:http://codeforces.com/contest/834/problem/A 思路: 水题 实现代码: #include<bits/st ...
- Codeforces Round #426 (Div. 2)A题&&B题&&C题
A. The Useless Toy:http://codeforces.com/contest/834/problem/A 题目意思:给你两个字符,还有一个n,问你旋转n次以后从字符a变成b,是顺时 ...
- 【Codeforces Round #426 (Div. 2) A】The Useless Toy
[Link]:http://codeforces.com/contest/834/problem/A [Description] [Solution] 开个大小为4的常量字符数组; +n然后余4,-n ...
- 【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,赢的人把自己 ...
随机推荐
- 730KII 打印机 Win7 2017年11月更新系统补丁后无法打印
卸载11月份编号为KB4048960的系统更新
- loj#6487 基础 FFT 练习题
分析 仔细观察a[i],b[i]的数据范围 于是我们转为枚举所有a[i],b[i]的值 然后暴力即可 代码 #include<bits/stdc++.h> using namespace ...
- pyspark 学习笔记
from pyspark.sql import SparkSession spark = SparkSession \ .builder \ .appName("Python Spark S ...
- 20160711--C# 委托的三种调用示例(同步调用 异步调用 异步回调)【转载】
首先,通过代码定义一个委托和下面三个示例将要调用的方法: 代码如下: public delegate int AddHandler(int a,int b); public class 加法类 { p ...
- 002-使用Spring实现读写分离(MySQL实现主从复制)
一. 背景 一般应用对数据库而言都是“读多写少”,也就说对数据库读取数据的压力比较大主库,负责写入数据,我们称之为:写库:从库,负责读取数据,我们称之为:读库: 1. 读库和写库的数据一致:2. 写数 ...
- 测开之路一百零七:bootstrap排版
引入bootstrap和jquery 标题 对齐 正文强调 引言 <!DOCTYPE html><html lang="en"><head> & ...
- hbase的API
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.*; import org.apache.had ...
- 前端 CSS的选择器 基本选择器
基本选择器包括: 标签选择器 类选择器 ID选择器 通用选择器 标签选择器 就是通过标签名来选择元素: 选中p标签 <!DOCTYPE html> <html lang=" ...
- python列表-增强的赋值操作
增强赋值公式 (1) (2) (3) (4)
- Intersection of Two Linked Lists(两个链表的第一个公共节点)
来源:https://leetcode.com/problems/intersection-of-two-linked-lists Write a program to find the node a ...