【CodeForces】426Div2 A The Useless Toy
来源:互联网 发布:java 字符串转日期 编辑:程序博客网 时间:2024/05/22 06:22
链接:http://codeforces.com/contest/834/problem/A
Solution:
很简单的整除判断
因为太久没有写过代码怕出问题,写得非常累赘(暴力)
#include<stdio.h>int ch(char a){ if (a=='^') return 1; if (a=='>') return 2; if (a=='v') return 3; if (a=='<') return 4;} int main() { char a,b; int n,r1,r2,i,j,tms; bool cw,ccw; scanf("%c %c",&a,&b); scanf("%d",&n); r1=ch(a);r2=ch(b); i=r1,j=r2; tms=0; while (i!=j) { tms++; if (i++==4) i=1; } cw=(tms<=n) && (((n-tms)&3)==0); i=r1,j=r2; tms=0; while (i!=j) { tms++; if (i--==1) i=4; } ccw=(tms<=n) && (((n-tms)&3)==0); if (cw^ccw) puts(cw?"cw":"ccw") ; else puts("undefined"); }
阅读全文
0 0
- 【CodeForces】426Div2 A The Useless Toy
- CodeForces #426 div2 A The Useless Tony
- 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
- Codeforces Round #426 (Div. 2) A The Useless Toy
- Codeforces Round #426 (Div. 2) A. The Useless Toy
- 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 水
- Codeforces 843A:The Useless Toy
- A. The Useless Toy
- A. The Useless Toy
- java中使用MD5验证文件的完整性
- 面试十大常见Java String问题
- C#机房重构——导出Excel表格
- HAProxy+nginx 负载均衡
- AJAX跨域问题
- 【CodeForces】426Div2 A The Useless Toy
- OpenCv设置摄像头参数/获得摄像头参数值
- 各种语言主要用途整理
- 花点时间想想那些还没用过你的产品的人吧
- java 设计模式理解 (1)简单工厂模式
- maven 手动把本地jar安装到本地仓库,maven手动安装依赖jar包
- 第十五章:泛型(下)
- java中4种修饰符访问权限
- git ssh配置多个账户 | 指定私钥登入