The correct usage of "BZOJ3884" "power-down Dafa" God and Set

Source: Internet
Author: User

Description According to some books, God's one failure of the creation experience is this: the first day,God created the basic elements of a world, called "Yuan". The next day,God created a new element, called "alpha". "Alpha" is defined as a set of "meta" components. It is easy to see that there are two different "alpha" types. On the third day,God has created a new element called "beta". "Beta" is defined as a set of "alpha" components. It is easy to find a total of four different "beta". Day Fourth,God created the new element "gamma", "gamma" is defined as the set of "beta". Obviously, there will be 16 different "gamma" altogether. If this goes on, the fourth element God created will be 65536, and the fifth element will have 2^65536. This is going to be an astronomical one. However, God did not expect the growth of the number of elements to be so rapid. He wants to enrich the elements of the world, so, day after day, year after year, he repeats the creation of new elements ... But soon, when God created the last element, "Theta," he found that there were so many elements in the world that the world's capacity was inadequate and unbearable. So on this day, God destroys the world. So far, God remembers the failure of the creation experience, and now he wants to ask you how many of the elements he created last time, "Theta"? God thinks the number may be too large to be expressed, so you just need to answer the value of this number to P modulo. You can think of God from "alpha" to "theta" altogether creating 10^9 elements, or 10^18 times, or simply ∞ times. Word test instructions: Input next T line, a positive integer p for each line, represents the value you need to modulo the Outputt line, a positive integer per line, the value of the answer to P modulo, sample Input3
2
3
6Sample Output0
1
4Hint for 100% of data, T<=1000,p<=10^7source

by POPOQQQ

Analysis

Actually, I'm here to spit the groove.

First, attach the following "official":

SB's question is a series of various disorderly 艹 ...

In fact, one day the brain hole relatively big suddenly want to calculate this thing = = then found this interesting nature = =

Actually +∞ a 2 look scary actually nothing terrible = =

Laugh silly, more fun nature? The author of the question even the power of the law do not know ... Also more fun nature ..... Power-down Dafa is much better than this ...

No more naked power-down dafa ....

1 /*2 Song Dynasty Zhu Dunru's3 "Xijiang Moon, the world is short like a Dream"4 the world is short like a dream, the human thin like autumn cloud. No need to care about elbow grease heart. Everything turns out to be alive. 5 Fortunately, three cups of wine is good, the situation every flower new. A laugh and a blind date. Tomorrow cloudy and clear undecided. 6 */7#include <cstdio>8#include <cstring>9#include <algorithm>Ten#include <cmath> One#include <queue> A#include <vector> -#include <iostream> -#include <string> the#include <ctime> - #defineLOCAL - Const intMAXN =10000000+Ten; - Const Long LongMOD =1000000007; + Const DoublePi = ACOs (-1.0); - Long LongG = the;//Original Root + Const intMAXM = -*2+Ten;  A using namespacestd; attypedefLong Longll; - intPHI[MAXN], PRIME[MAXN]; -  - voidReadint&AMP;X) {//read-in optimization -     CharCh;x =0; -     intFlag =1; inCH =GetChar (); -      while(Ch <'0'|| CH >'9') {if(ch = ='0') flag =-1; CH =GetChar ();} to      while(Ch >='0'&& CH <='9') {x = x *Ten+ (CH-'0'); CH =GetChar ();} +X *=Flag; - } the  * voidPrepare () {//preprocessing Phi Functions $memset (Prime,0,sizeof(prime));Panax Notoginseng       for(inti =2; I <=10000000; i++){ -          if(!Prime[i]) { theprime[++prime[0]] =i; +Phi[i] = i-1; A             //printf ("%d\n", Prime[prime[0]]); the          } +           for(intj =1; J <= prime[0]; J + +){ -              if((Long Long) I * (Long Long) Prime[j] > 10000000LL) Break; $Prime[i * Prime[j]] =1; $              if(i% prime[j] = =0){ -Phi[i * Prime[j]] = phi[i] *Prime[j]; -                  Break; the}Else{ -Phi[i * Prime[j]] = phi[i] * (PRIME[J)-1);Wuyi              } the          } -      } Wu } - ll Pow (ll A, ll B, ll c) { About     if(b = =0)return 1%C; $     if(b = =1)returnAC; -ll tmp = POW (A, b/2, c); -     if(b%2==0)return(TMP * tmp)%C; -     Else return((TMP * tmp)% c) * (a% c))%C; A } + ll Work (ll N) { the     if(n = = 1ll)return 0; -     returnPow (2LL, (LL) work ((LL) phi[n]) +(LL) phi[n]), n); $ } the  the intMain () { the     intT; the      - prepare (); inscanf"%d", &T); the      while(t--){ the ll N; Aboutscanf"%lld", &n); theprintf"%lld\n", Work (n)); the     } the     return 0; +}
View Code

The correct usage of "BZOJ3884" "power-down Dafa" God and Set

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.