大数乘,果断java A了。

 import java.util.Scanner;
import java.lang.StringBuilder;
import java.math.BigInteger; public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
while (cin.hasNextLine()) {
String line = cin.nextLine();
int length = line.length();
int[] cnt = new int[10];
for (int i=0; i<length; ++i) {
++cnt[line.charAt(i)-'0'];
}
boolean flag = true;
BigInteger org = new BigInteger(line);
for (int i=2; i<=length; ++i) {
BigInteger tmp = org.multiply(new BigInteger(String.valueOf(i)));
String s = tmp.toString();
int[] scnt = new int[10];
if (s.length() < length)
scnt[0] += length - s.length();
for (int j=0; j<s.length(); ++j)
++scnt[s.charAt(j)-'0'];
for (int j=0; j<10; ++j) {
if (scnt[j] != cnt[j]) {
flag = false;
break;
}
}
if (!flag)
break;
}
if (flag)
System.out.println(line+" is cyclic");
else
System.out.println(line+" is not cyclic");
}
}
}

【HDOJ】1313 Round and Round We Go的更多相关文章

  1. 【LA3523】 Knights of the Round Table (点双连通分量+染色问题?)

    Being a knight is a very attractive career: searching for the Holy Grail, saving damsels in distress ...

  2. 【C#】Excel舍入函数Round、RoundUp、RoundDown的C#版

    本人在C#中进行小数舍入的时候常常会怀念Excel中的Round.RoundUp.RoundDown这几个函数,原因就是后者“接地气”,比较符合俺小老百姓的舍入要求,啥“银行家舍入法”就让银行家用去吧 ...

  3. 【C#】取整函数Math.Round、Math.Ceiling和Math.Floor区别

    Math.Round 原则: 四舍六入五取偶. 也就是说 0.1-0.4为0 0.5为0 0.6-0.9为1 1.5为2 Math.Ceiling 原则: 有小数就加1 0.1 = 1 Math.Fl ...

  4. 【BZOJ】1662: [Usaco2006 Nov]Round Numbers 圆环数(数位dp)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1662 这道题折腾了我两天啊-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 果然 ...

  5. 【转载】 C#使用Math.Round方法对计算结果进行四舍五入操作

    在C#的数值运算中,有时候需要对计算结果进行四舍五入操作,此时就可使用内置方法Math.Round方法来实现四舍五入操作,Math.Round方法有多个重载函数,支持设置有效位数进行四舍五入,如果没有 ...

  6. 【转载】Sqlserver中使用Round函数对计算结果四舍五入

    在实际应用的计算中,很多时候我们需要对最后计算结果四舍五入,其实在Sqlserver中也有对应的四舍五入函数,就是Round函数,Round函数的格式为Round(column_name,decima ...

  7. 【poj2942】 Knights of the Round Table

    http://poj.org/problem?id=2942 (题目链接) 题意 有n个骑士要去参加圆桌会议,他们将围成一圈,想要他们不打架,当且仅当参加圆桌会议的骑士数为奇数并且相邻的两个骑士不互相 ...

  8. 【二分】Producing Snow @Codeforces Round #470 Div.2 C

    time limit per test: 1 second memory limit per test: 256 megabytes Alice likes snow a lot! Unfortuna ...

  9. 【贪心】Google Code Jam Round 1A 2018 Waffle Choppers

    题意:给你一个矩阵,有些点是黑的,让你横切h刀,纵切v刀,问你是否能让切出的所有子矩阵的黑点数量相等. 设黑点总数为sum,sum必须能整除(h+1),进而sum/(h+1)必须能整除(v+1). 先 ...

随机推荐

  1. 动画Rig设置为Legacy

    The animation state AimUp could not be played because it couldn't be found!Please attach an animatio ...

  2. Android 设计模式之观察者模式(转载自:“http://blog.csdn.net/fangchongbory/article/details/7774044”)

    /* * 观察者模式 *      定义对象间的一种一个(Subject)对多(Observer)的依赖关系,当一个对象的状态发送改变时,所以依赖于它的 * 对象都得到通知并被自动更新 * * 当然, ...

  3. mvc存储Cookie和读取Cookie方法

    mvc存储Cookie和读取Cookie方法: //存储 HttpCookie cookie = new HttpCookie("User"); System.Text.Encod ...

  4. JS获取客户端的窗口大小

    function getClientSize() {    var c = window,    b = document,    a = b.documentElement;    if (c.in ...

  5. 【转】mysql数据库中实现内连接、左连接、右连接

    [转]mysql数据库中实现内连接.左连接.右连接 内连接:把两个表中数据对应的数据查出来 外连接:以某个表为基础把对应数据查出来 首先创建数据库中的表,数据库代码如下: /* Navicat MyS ...

  6. [JS] 如何清空file input框 [整理]

    测试环境:OS --> winXPBrowsers --> IE6+, FF 3.0.11, FF 3.5, Opera 9.64, Opera 10 beta 2, Safari 4, ...

  7. windowIsTranlucent 属性

    项目中踩的大坑.  先埋. int alwaysFinish = 0; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERS ...

  8. Mavne + Spring整合CXF

    http://blog.csdn.net/xiongyu777888/article/details/23787615(没毛病) http://blog.csdn.net/hbsong75/artic ...

  9. Data Types

    原地址: Home / Database / Oracle Database Online Documentation 11g Release 2 (11.2) / Database Administ ...

  10. POJ 2010 Moo University - Financial Aid( 优先队列+二分查找)

    POJ 2010 Moo University - Financial Aid 题目大意,从C头申请读书的牛中选出N头,这N头牛的需要的额外学费之和不能超过F,并且要使得这N头牛的中位数最大.若不存在 ...