http://acm.hdu.edu.cn/showproblem.php?pid=4662

I+3*U模6为2或4的都可以 一个U相当于3个I  而I只能1-》2-》4-》8。。如此变换

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char s[];
int main()
{
int i,n;
cin>>n;
while(n--)
{
cin>>s;int a=,b=;
int k = strlen(s);
if(s[]!='M')
{
puts("No");
continue;
}
if(strcmp(s,"MI")==)
{
puts("Yes");
continue;
}
for(i = ; i < k ; i++)
if(s[i]=='I') a++;
else if(s[i]=='U') b++;
else break;
if(i!=k)
{
puts("No");
continue;
}
int s = a+b*;
if(s%==||s%==)
puts("Yes");
else
puts("No");
}
return ;
}

hdu4662MU Puzzle的更多相关文章

  1. Puzzle 面向服务/切面(AOP/IOC)开发框架 For .Net

    Puzzle 面向服务/切面AOP开发框架 For .Net AOP主要实现的目的是针对业务处理过程中的切面进行提取,它所面对的是处理过程中的某个步骤或阶段,以获得逻辑过程中各部分之间低耦合性的隔离效 ...

  2. HDU5456 Matches Puzzle Game(DP)

    题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5456 Description As an exciting puzzle game for ...

  3. one recursive approach for 3, hdu 1016 (with an improved version) , permutations, N-Queens puzzle 分类: hdoj 2015-07-19 16:49 86人阅读 评论(0) 收藏

    one recursive approach to solve hdu 1016, list all permutations, solve N-Queens puzzle. reference: t ...

  4. poj3678 Katu Puzzle 2-SAT

    Katu Puzzle Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6714   Accepted: 2472 Descr ...

  5. POJ1651Multiplication Puzzle[区间DP]

    Multiplication Puzzle Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8737   Accepted:  ...

  6. codeforce B Island Puzzle

    B. Island Puzzle time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...

  7. poj 1651 Multiplication Puzzle (区间dp)

    题目链接:http://poj.org/problem?id=1651 Description The multiplication puzzle is played with a row of ca ...

  8. Ignatius's puzzle

    Ignatius's puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...

  9. A hard puzzle

    A hard puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tot ...

随机推荐

  1. ERROR ITMS-90049错误解决

    检查一下项目有集成友盟,shareSDK这种第三方包,里面有个腾讯bundle,包含了一个Info.plist. 去掉,就可以了.类似有其他第三方的bundle,可能也会出现这个问题. 原因估计是Ap ...

  2. linux命令行下命令参数前的一横(-)和两横(--)的区别

    原文转自:http://blog.csdn.net/songjinshi/article/details/6816776 在解释这些区别之前我们先了解一下有关linux的背景知识,这个需要大家先认真看 ...

  3. OpenJudge/Poj 1661 帮助 Jimmy

    1.链接地址: bailian.openjudge.cn/practice/1661 http://poj.org/problem?id=1661 2.题目: 总Time Limit: 1000ms ...

  4. 第33条:用EnumMap代替序数索引

    有时候,会见到利用ordinal方法来索引数组的代码.例如下面这个简化的类,表示一种烹饪用的香草: public class Herb { public enum Type { ANNUAL, PER ...

  5. DataGridView实现分页

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; u ...

  6. HttpWebRequest中的SendChunked

    MSDN上说:When SendChunked is true, the request sends data to the Internet resource in segments. The In ...

  7. python通过webservice连接cmdbuild

    cmdbuild的部署可以查看文章:http://20988902.blog.51cto.com/805922/1541289 部署成功后,访问http://192.168.1.1:8080/cmdb ...

  8. SDC(3)–set_multicycle_path 最关键的一张图

    上图意思是,假如使用 –setup option,默认约束的是 latch clock:假如使用 –hold option,默认约束的是 launch clock.箭头表示不同组合下时钟沿的移动方向. ...

  9. C#基础|面向对象之多态

      什么是多态   一句话解释,同一种事物表现出的多种形态. 看完以后,应该还是蒙的,还是看代码吧.. 现有Person类,Student类,Teacher类 其中Person类是Student和Te ...

  10. ubuntu下的文本查看相关命令

    文本查看 1.cat命令(查看文本内容) 使用时三种常用模式 (1)cat 文本名 直接查看文本内容 (2)cat 文本名 -n 直接查看文本内容,但为文本中所有行编号 (3)cat 文本名 -b 直 ...