(hdu)5391 Zball in Tina Town】的更多相关文章

题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5391 Problem Description Tina Town is a friendly place. People there care about each other. Tina has a ball called zball. Zball time times )-th day. Tina want to know its size on the (n-)-th day mo…
版权声明: 本文为博主Bravo Yeung(知乎UserName同名)的原创文章,欲转载请先私信获博主允许,转载时请附上网址 http://blog.csdn.net/lzuacm. HDUoj 5391 - Zball in Tina Town 在线提交: http://acm.hdu.edu.cn/showproblem.php?pid=5391 Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 262144/262144 K (Ja…
<题目链接> Zball in Tina Town Problem Description Tina Town is a friendly place. People there care about each other.Tina has a ball called zball. Zball is magic. It grows larger every day. On the first day, it becomes 1 time as large as its original siz…
Zball in Tina Town Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Problem Description Tina Town is a friendly place. People there care about each other. Tina has a ball called zball. Zball is magic. It grows lar…
问题描述 Tina Town 是一个善良友好的地方,这里的每一个人都互相关心. Tina有一个球,它的名字叫zball.zball很神奇,它会每天变大.在第一天的时候,它会变大11倍.在第二天的时候,它会变大22倍.在第nn天的时候,它会变大nn倍. zball原来的体积是11.Tina想知道,zball在第n-1n−1天时的体积对nn取模是多大呢? Tina是一个蠢蠢的女孩子,当然不会算啦,所以她请你帮她算出这个答案呢. 输入描述 第一行一个正整数TT,表示数据组数 接下来TT行,每行一个正整…
题意: Tina有一个球,它的名字叫zball.zball很神奇,它会每天变大.在第一天的时候,它会变大1倍.在第二天的时候,它会变大2倍.在第n天的时候,它会变大n倍.zball原来的体积是1.Tina想知道,zball在第n−1天时的体积对n取模是多大呢? 思路: 如果n是一个合数,那它肯定是有因子的,即有两个比它小的数字a和b,使得a*b=n,那么答案必为0.如果是质数,打表可知是n-1.数字小的直接算,防止意外.数字都不会超过int. #include <cstdio> #includ…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5391 相关数论结论: 威尔逊定理——当且仅当p为素数时:( p -1 )! ≡ p-1 ( mod p ) 这道题一开始看到的时候以为是暴力的题目,快速阶乘取模,后来其他题做不出来回头看这道题, 发现可以找规律,当p是合数的时候,P的因子全都可以在P前面的数字的因子里找到, 当p是素数的时候,(p-1)!%p = p-1,就尝试写了一下,2A: 因为4是个例外,怕还有其他例外情况,在100以内小规模…
(n-1)!/n 就是如果n为素数,就等于n-1else为0. 求素数表: Zball in Tina Town Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 833 Accepted Submission(s): 477 Problem Description Tina Town is a friendly place. People…
转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Zball in Tina Town Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 219    Accepted Submission(s): 144 Problem Description Tina Town i…
题目传送门 /* 题意: 求(n-1)! mod n 数论:没啥意思,打个表能发现规律,但坑点是4时要特判! */ /************************************************ * Author :Running_Time * Created Time :2015-8-15 19:06:12 * File Name :A.cpp ************************************************/ #include <cstdi…