锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲欧洲精品成人久久奇米网
,精品多毛少妇人妻AV免费久久
,亚洲中文精品久久久久久不卡
http://www.shnenglu.com/Yuan/category/16255.htmlzh-cn Sun, 07 Aug 2011 15:29:07 GMT Sun, 07 Aug 2011 15:29:07 GMT 60 hdu 3826 http://www.shnenglu.com/Yuan/archive/2011/08/07/152690.html_Yuan _Yuan Sat, 06 Aug 2011 18:40:00 GMT http://www.shnenglu.com/Yuan/archive/2011/08/07/152690.html http://www.shnenglu.com/Yuan/comments/152690.html http://www.shnenglu.com/Yuan/archive/2011/08/07/152690.html#Feedback 0 http://www.shnenglu.com/Yuan/comments/commentRss/152690.html http://www.shnenglu.com/Yuan/services/trackbacks/152690.html /**/ /* 闂畁<=10^18鏄惁鑳借涓涓暟鐨勫鉤鏂規(guī)暣闄?br /> 灝唍鍒嗚В涓猴細(xì)p1p2 pk 鍏朵腑pi涓虹礌鏁幫紝涓攑i<=pi+1錛堣繖閲屽彲浠ョ瓑浜庯級 鑻鑳借涓涓暟鐨勫鉤鏂規(guī)暣闄わ紝瀹冭偗瀹氳兘琚竴涓礌鍥犲瓙鐨勫鉤鏂筽^2鏁撮櫎錛屾垜浠壘鍒版渶灝忕殑榪欎釜p鍗沖彲 ~~~ 1.濡傛灉p涓嶆槸鏈鍚庣殑绱犲洜瀛愶紝鍦╬涔嬪悗鐨勭礌鏁皃i>=p錛岃繖鏃跺氨鏈塶>=p^3浜嗭紝 鍗硃<=n^(1/3)錛屾墍浠ユ灇涓緉^(1/3)鍐呯殑绱犳暟鐪嬫槸鍚^2|n鍗沖彲錛岃宯^(1/3)<=10^6 2.濡傛灉p鏄渶鍚庣殑绱犲洜瀛愶紝鎵浠鐨勫艦寮忓氨鏄痯1p2 p'p^2錛岃宲'<=p錛屾墍浠'^3<=n錛宲'<=n^(1/3) 鎵浠ュ彲浠ュ厛灝唍鐨勮繖浜涚礌鍥犲瓙p1,p2, ,p'緇欏幓鎺夛紝p'<=n^(1/3)錛屾墍浠ョ敤n^(1/3)鍐呯殑绱犳暟鍘婚櫎鍗沖彲 鏈鍚庡彧鍓╀笅n'=p^2錛岄氳繃鍒ゆ柇涓涓暟鏄惁涓哄畬鍏ㄥ鉤鏂規(guī)暟鍗沖彲 綆楁硶灝辨槸棰勫鐞?0^6鍐呯殑绱犳暟錛岀敤榪欎簺绱犳暟鍘婚櫎n錛屽彂鐜版湁p^2鑳芥暣闄ょ殑return鍗沖彲 鍚﹀垯鍒ゆ柇鍓╀笅鐨勮繖涓猲'鏄惁涓哄畬鍏ㄥ鉤鏂規(guī)暟錛屾垜鏄敤浜屽垎鍒ゆ柇鐨勶紝鍔犱簡double澶勭悊long long 婧㈠嚭*/ #include< cstdio > #include< cstring > #include< algorithm > #include< vector > #include< queue > #include< string > #include< iostream > #include< cassert > using namespace std; bool isp[ 1000010 ]; int pr[ 300000 ], pn; void init() { for ( int p = 2 ; p <= 1000000 ; p ++ ) { if ( ! isp[p]) { pr[pn ++ ] = p; for ( long long j = ( long long )p * p; j <= 1000000 ; j += p) { isp[j] = 1 ; } } } }// n = p1p2 pk bool chk( long long n) { for ( int i = 0 ; i < pn && pr[i] <= n; i ++ ) { if (n % pr[i] == 0 ) { n /= pr[i]; if (n % pr[i] == 0 ) return 0 ; } } if (n == 1 ) { return 1 ; } long long left = 1 , right = n; while (left <= right) { long long mid = (left + right) / 2 ; if (( double )mid * mid > n) right = mid - 1 ; // double !! else left = mid + 1 ; } return right * right != n; } int main() { // freopen("in.txt", "r", stdin); init(); int T, t = 1 ; for (scanf( " %d " , & T); T -- ; ) { printf( " Case %d: " , t ++ ); long long n; scanf( " %I64d " , & n); puts(chk(n) ? " Yes " : " No " ); } return 0 ; } ]]>CF17D 澶ф暣鏁板彇浣?/title> http://www.shnenglu.com/Yuan/archive/2011/05/03/145594.html_Yuan _Yuan Tue, 03 May 2011 11:14:00 GMT http://www.shnenglu.com/Yuan/archive/2011/05/03/145594.html http://www.shnenglu.com/Yuan/comments/145594.html http://www.shnenglu.com/Yuan/archive/2011/05/03/145594.html#Feedback 0 http://www.shnenglu.com/Yuan/comments/commentRss/145594.html http://www.shnenglu.com/Yuan/services/trackbacks/145594.html /**/ /* 灝辨槸姹?b-1)*b^(n-1) % c 鍏朵腑2<=b<=10^10^6 1<=n<=10^10^6,1<=c<=10^9 鐢↗ava楂樼簿搴︼紝瓚呮椂浜?img src="http://www.shnenglu.com/Images/dot.gif"> 鐪嬩簡鍒漢鐨勪唬鐮侊紝紲炲涓?img src="http://www.shnenglu.com/Images/dot.gif"> b % c 鍏朵腑b鏄ぇ鏁存暟錛屽彲浠ヤ粠楂樹綅寰浣庝綅閫愪綅鎼?nbsp;r = (r*10+b[i])%c 鏇寸濂囩殑鏄紝a^b%c涓鏍蜂篃鍙互鐢ㄤ笂闈㈤偅鏍峰瓙鎼?br> 浣嗘槸灝變笉鏄痳*10鑰屾槸r^10, r = (r^10*(a^b[i]))%c a^b[i]鍙互棰勫鐞嗭紝鍗砤^0,a^1, ,a^9 鏈夌敤鍏紡 a^b % c = a^b' %c 鍏朵腑b' = b>= p?b%p+p: b%p p = phi(c) 榪欎釜鍏紡鎴愮珛涓嶉渶瑕?a,c)=1!!!*/ #include< iostream > #include< cstring > #include< map > #include< algorithm > #include< stack > #include< queue > #include< cmath > #include< string > #include< cstdlib > #include< vector > #include< cstdio > #include< set > #include< list > #include< numeric > #include< cassert > #include< ctime > #include< bitset > using namespace std; const int MAXN = 1000010 ; char b[MAXN], n[MAXN]; long long p[ 10 ]; int main() { #ifndef ONLINE_JUDGE // freopen("in","r",stdin); #endif for ( long long c; ~ scanf( " %s%s%I64d " , b, n, & c); ) { // (b-1)*b^(n-1) % c int len = strlen(b); long long r = 0 , left; for ( int i = 0 ; i < len ; i ++ ) { // r = b%c r = (r * 10 + b[i] - ' 0 ' ) % c; } left = (r + c - 1 ) % c; len = strlen(n); for ( int i = len - 1 ; i >= 0 ; i -- ) { if (n[i] == ' 0 ' ) { n[i] = ' 9 ' ; } else { n[i] -- ; break ; } } // p[i] = b^i % c; p[ 0 ] = 1 ; for ( int i = 1 ; i < 10 ; i ++ ) { p[i] = p[i - 1 ] * r % c; } r = 1 ; for ( int i = 0 ; i < len ; i ++ ) { long long t = r; for ( int j = 1 ;j < 10 ; j ++ ) { // b^(l*10) r = r * t % c; } r = r * p[n[i] - ' 0 ' ] % c; } r = left * r % c; printf( " %I64d\n " , r == 0 ? c : r); } return 0 ; }
]]> poj 1845 http://www.shnenglu.com/Yuan/archive/2011/03/14/141825.html_Yuan _Yuan Mon, 14 Mar 2011 14:51:00 GMT http://www.shnenglu.com/Yuan/archive/2011/03/14/141825.html http://www.shnenglu.com/Yuan/comments/141825.html http://www.shnenglu.com/Yuan/archive/2011/03/14/141825.html#Feedback 0 http://www.shnenglu.com/Yuan/comments/commentRss/141825.html http://www.shnenglu.com/Yuan/services/trackbacks/141825.html 闃呰鍏ㄦ枃 ]]> hdu 3187 嬈ф媺鍑芥暟 鏋氫婦p-1 鈽呪槄鈽呪槄 http://www.shnenglu.com/Yuan/archive/2011/03/14/141776.html_Yuan _Yuan Mon, 14 Mar 2011 03:55:00 GMT http://www.shnenglu.com/Yuan/archive/2011/03/14/141776.html http://www.shnenglu.com/Yuan/comments/141776.html http://www.shnenglu.com/Yuan/archive/2011/03/14/141776.html#Feedback 0 http://www.shnenglu.com/Yuan/comments/commentRss/141776.html http://www.shnenglu.com/Yuan/services/trackbacks/141776.html /**/ /* 緇欏嚭n錛岄棶婊¤凍phi(k) = n鐨刱鐨勪釜鏁幫紝鍏朵腑k鐨勭礌鍥犲瓙涓暟<=3 n<2^31 嬈ф媺鍑芥暟 phi(k) = k(1-1/p1)(1-1/p2)(1-1/p3) = (p1-1)p1^x*(p2-1)p2^y*(p3-1)p3^z phi(1) = 1 姣旇禌鏃舵墦綆楃瓫绱犳暟錛堢瓫鍒皊qrt(2^31)錛夛紝鏋氫婦p1,p2,p3 鏈夐棶棰樼殑錛屾瘮濡?nbsp;n = (3-1) * p 褰搉寰堝ぇ鏃訛紝榪欐牱p灝辨槸涓涓緢澶х殑鏁頒簡錛岃岀礌鏁拌〃娌℃湁錛屽氨鏋氫婦涓嶅埌浜嗭紒 闂簡ACOrz錛屼粬鐨勪唬鐮佸緢紲炲鍛 鍥犱負(fù)n = (p1-1)p1^x*(p2-1)p2^y*(p3-1)p3^z 鐢╯qrt(n)鏋氫婦(pi-1) if(n%(pi-1) && isPrime(pi))鍔犲叆pi 鐒跺悗灝眃fs鍑烘渶澶?涓暟錛岃 (p1-1)p1^x*(p2-1)p2^y*(p3-1)p3^z = n 娉ㄦ剰鐨勬槸phi(1) = 1 鎵浠=1鏃?婊¤凍鏉′歡鐨勬湁2涓紝鍗砶=1,2 ACOrz鐨勪唬鐮佸緢綆媧侊紝涓嬮潰鏄垜鎸夌収鎴戠殑椋庢牸妯′豢浠栧啓鐨?br> 娉ㄦ剰鏋氫婦鐨勬槸(pi - 1)錛屼笉鏄痭鐨勭礌鍥犲瓙 錛侊紒錛?br>*/ #include< iostream > #include< cstring > #include< map > #include< algorithm > #include< stack > #include< queue > #include< cmath > #include< string > #include< cstdlib > #include< vector > #include< cstdio > #include< set > #include< list > #include< numeric > #include< cassert > #include< ctime > using namespace std; vector < int > prime; int ans; bool isPrime( int n) { for ( int p = 2 ; p <= n / p ; p ++ ) { if (n % p == 0 ) { return false ; } } return true ; } void dfs( int next, vector < int > with, int n) { int nn = n; bool can = true ; for (vector < int > ::iterator it = with.begin() ; it != with.end() ; it ++ ) { // 媯鏌ュ悎娉曟?/span> if (n % ( * it - 1 ) == 0 ) { n /= ( * it - 1 ); } else { can = false ; break ; } } if (can) { // with鍙互涓虹┖錛侊紒錛?/span> for (vector < int > ::iterator it = with.begin() ; it != with.end() ; it ++ ) { while (n % * it == 0 ) { n /= * it; } } if (n == 1 )ans ++ ; // 鐗規(guī)畩鎯呭喌鏄痺ith涓虹┖錛屼絾鍘熷鐨刵涓? if (with.size() == 3 ) { return ; } for ( int i = next ; i < prime.size(); i ++ ) { // 鎵╁睍 with.push_back(prime[i]); dfs(i + 1 , with, nn); with.pop_back(); } } } int main() { #ifndef ONLINE_JUDGE // freopen("in","r",stdin); #endif for ( int n; ~ scanf( " %d " , & n); ) { prime.clear(); for ( int i = 1 ; i <= n / i; i ++ ) { if (n % i == 0 ) { if (isPrime(i + 1 )) { prime.push_back(i + 1 ); } if (n / i != i && isPrime(n / i + 1 )) { prime.push_back(n / i + 1 ); } } } ans = 0 ; dfs( 0 , vector < int > (), n); printf( " %d\n " , ans); } return 0 ; }
]]>CodeForces 60D 鍕捐偂鏁板叕寮?鏋氫婦鐢熸垚 http://www.shnenglu.com/Yuan/archive/2011/02/21/140358.html_Yuan _Yuan Mon, 21 Feb 2011 03:15:00 GMT http://www.shnenglu.com/Yuan/archive/2011/02/21/140358.html http://www.shnenglu.com/Yuan/comments/140358.html http://www.shnenglu.com/Yuan/archive/2011/02/21/140358.html#Feedback 0 http://www.shnenglu.com/Yuan/comments/commentRss/140358.html http://www.shnenglu.com/Yuan/services/trackbacks/140358.html /**/ /* n<=10^6涓偣錛屾瘡涓偣鏈夋潈鍊糰[i]<=10^7 鍚勪笉鐩稿悓 鑻ュ瓨鍦ㄤ竴涓暟x錛屼嬌寰梐[i],a[j],x is a beautiful triple 鍗砤^2 + b^2 = c^2 a,b,c浜掔礌 鍒檌鍙互浼犳挱laugh鍒癹 闂渶灝戦渶瑕侀渶瑕佽澶氬皯涓《鐐硅嚜琛宭augh錛岀劧鍚庝紶鎾埌鍏ㄩ儴鐨勯《鐐?br> 鐪嬩簡瑙i鎶ュ憡鐨?br> 騫舵煡闆嗗仛 浣嗗浣曞垽鏂璪eautiful triple 涓や袱鍒ゆ柇O(n^2)浼?xì)瓒呮?br> 鏈変釜鎬ц川錛氬浜庢弧瓚砤^2 + b^2 = c^2鐨勬暟錛屽彲鐢ㄥ嬀鑲℃暟鍏紡鐢熸垚錛?br> (x^2-y^2 , 2xy , x^2+y^2) x>y 璇ュ叕寮忚兘鐢熸垚鎵鏈夌殑绱犲嬀鑲℃暟錛堜簰璐級錛岄渶1濂?鍋?nbsp;錛屼笖gcd(x,y) = 1 涔熻兘鐢熷嚭閮ㄥ垎媧劇敓鍕捐偂鏁?濡?nbsp;6 8 10) 錛?nbsp;2濂囨垨2鍋?br> 鐢變簬a[i]<=MAX MAX= 10^7 鎵浠ュ繀鏈墄^2-y^2 <= MAX , 2xy <= MAX 浣唜^2+y^2涓嶄竴瀹?lt;= MAX 2y^2<=MAX x^2<=MAX+y^2<=3MAX/2 => x<=sqrt(3MAX/2) , y <= sqrt(MAX/2) 鎵浠ユ灇涓緓,y澶嶆潅搴︿負(fù)O(MAX) (娉ㄦ剰x,y鏄?濂?鍋朵笖gcd(x,y) = 1) 鍙傝僿atashi浠g爜鍐欑殑 */ #include< iostream > #include< cstring > #include< map > #include< algorithm > #include< stack > #include< queue > #include< cmath > #include< string > #include< cstdlib > #include< vector > #include< cstdio > #include< set > #include< list > using namespace std; const int MAX = 10000000 ; const int MAXX = ( int )(sqrt( 1.5 * MAX) + 0.5 ); const int MAXN = 1000000 ; struct DisjointSet { int fa[MAXN]; void init( int n) { for ( int i = 1 ; i <= n ; i ++ ) { fa[i] = i; } } int root( int x) { return x == fa[x] ? x : fa[x] = root(fa[x]); } bool join( int a , int b) { a = root(a); b = root(b); if (a != b) { fa[a] = b; return true ; } return false ; } }; DisjointSet ds; int id[MAX + 10 ]; inline int gcd( int x , int y) { return y == 0 ? x : gcd(y , x % y); } bool gao( int a , int b) { return id[a] > 0 && id[b] > 0 && ds.join(id[a],id[b]); } int main() { for ( int n ; ~ scanf( " %d " , & n) ; ) { fill(id,id + MAX + 1 , 0 ); ds.init(n); for ( int i = 1 ,x; i <= n ; i ++ ) { scanf( " %d " , & x); id[x] = i; } for ( int x = 1 ; x <= MAXX ; x ++ ) { for ( int y = x % 2 + 1 ; y < x ; y += 2 ) { if (gcd(x, y) == 1 ) { // need it int a = x * x - y * y; int b = 2 * x * y; int c = x * x + y * y; if (a > MAX || b > MAX) { continue ; } n -= gao(a,b); if (c <= MAX) { n -= gao(a,c); n -= gao(b,c); } } } } printf(" %d\n " ,n); } return 0 ; }
]]>
亚洲精品乱码久久久久66 |
国产精品久久久福利 |
草草久久久无码国产专区 |
亚洲中文字幕无码久久综合网 |
伊人丁香狠狠色综合久久 |
A狠狠久久蜜臀婷色中文网 |
久久精品国产免费观看三人同眠 |
久久se精品一区二区影院
|
色综合久久无码中文字幕 |
香蕉久久AⅤ一区二区三区 |
久久AAAA片一区二区 |
精品久久久久久久久久久久久久久 |
久久久久久亚洲精品成人 |
婷婷久久五月天 |
久久综合狠狠综合久久97色 |
国产亚洲美女精品久久久 |
精品无码久久久久久久动漫 |
久久成人国产精品一区二区 |
久久精品夜色噜噜亚洲A∨ |
久久亚洲高清综合 |
亚洲人AV永久一区二区三区久久 |
欧美久久亚洲精品 |
久久经典免费视频 |
久久久久久久精品成人热色戒 |
怡红院日本一道日本久久 |
久久久久国产视频电影 |
性做久久久久久免费观看 |
久久久久av无码免费网 |
亚洲日韩中文无码久久 |
久久精品国产亚洲77777 |
久久久久综合网久久 |
久久精品一区二区三区中文字幕 |
欧美色综合久久久久久 |
伊人久久综合无码成人网 |
99999久久久久久亚洲 |
国产精品成人99久久久久91gav |
理论片午午伦夜理片久久
|
久久久久亚洲AV无码麻豆 |
91精品国产综合久久久久久 |
午夜不卡888久久 |
人妻丰满?V无码久久不卡 |