UVa11344 - The Huge One
来源:互联网 发布:北宋出相 知乎 编辑:程序博客网 时间:2024/05/18 06:25
import java.util.*;import java.math.BigInteger;import java.io.*;class Main{public static void main(String[] args) {Scanner cin;int t;boolean flag;int n;int div;int i;cin = new Scanner(System.in);t = cin.nextInt();while (t-- > 0) {String s = cin.next();if (s.compareTo("0") == 0) {n = cin.nextInt();while (n-- > 0) {div = cin.nextInt();}System.out.println(s + " - Wonderful.");continue;}flag = true;n = cin.nextInt();BigInteger num = new BigInteger(s);for (i = 0; i < n && flag; i++) {div = cin.nextInt();if (div == 1) {continue;} else if (div == 2) {int tail = s.charAt(s.length() - 1) - '0';if (tail % 2 != 0) flag = false;} else {if (num.remainder(BigInteger.valueOf(div)).compareTo(BigInteger.ZERO) != 0) flag = false;}}for (; i < n; i++){div = cin.nextInt();}if (flag) {System.out.println(s + " - Wonderful.");} else {System.out.println(s + " - Simple.");}}}}
0 0
- UVa11344 - The Huge One
- UVa 11344 The Huge One (模性质)
- The One
- the one
- THE ONE
- The One
- THE ONE
- The One
- The One
- Where is the Huge Data ?(巨大的数据在那里?)
- This poses a huge problem for the Obama Administration
- One of the MulticastTest
- The First One
- The One Foundation
- The Second One
- the first one
- Choose the second one
- exception the last one.
- 值得一看的英国曼彻斯特大学某技术博客
- Html5无刷新修改browser Url
- Makefile 的多行注释
- [LeetCode]26.Remove Duplicates from Sorted Array
- 关于程序员的作息安排(个人拙见)
- UVa11344 - The Huge One
- 快速积累高质量的人脉:互相推荐合适的朋友
- 使用ScheduledExecutorService接口实现Web轮询项目
- 生成自定义区间随机整数
- MSDN2012离线版
- Linux设备驱动之I2C架构分析
- JAVA获取图片大小和尺寸
- android客户端 j2ee服务器端架构的聊天系统实现思路
- 编译预处理