F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_16345752_30559.cpp:1:50: error: stray '#' in program
 <li class="alt"><span><span class="preprocessor">#include <iostream></span><span>  </span></span></li><li class=""><span><span class="preprocessor">#include <stdlib.h></span><span>  </span></span></li><li class="alt"><span><span class="preprocessor">#include <string.h></span><span>  </span></span></li><li class=""><span><span class="preprocessor">#include <algorithm></span><span>  </span></span></li><li class="alt"><span><span class="preprocessor">#include <stdio.h></span><span>  </span></span></li><li class=""><span>  </span></li><li class="alt"><span><span class="keyword">const</span><span> </span><span class="datatypes">int</span><span> Times = 10;  </span></span></li><li class=""><span><span class="keyword">const</span><span> </span><span class="datatypes">int</span><span> N = 5500;  </span></span></li><li class="alt"><span>  </span></li><li class=""><span><span class="keyword">using</span><span> </span><span class="keyword">namespace</span><span> std;  </span></span></li><li class="alt"><span><span class="keyword">typedef</span><span> </span><span class="datatypes">long</span><span> </span><span class="datatypes">long</span><span> LL;  </span></span></li><li class=""><span>  </span></li><li class="alt"><span>LL ct, cnt;  </span></li><li class=""><span>LL fac[N], num[N];  </span></li><li class="alt"><span>  </span></li><li class=""><span>LL gcd(LL a, LL b)  </span></li><li class="alt"><span>{  </span></li><li class=""><span>    <span class="keyword">return</span><span> b? gcd(b, a % b) : a;  </span></span></li><li class="alt"><span>}  </span></li><li class=""><span>  </span></li><li class="alt"><span>LL multi(LL a, LL b, LL m)  </span></li><li class=""><span>{  </span></li><li class="alt"><span>    LL ans = 0;  </span></li><li class=""><span>    a %= m;  </span></li><li class="alt"><span>    <span class="keyword">while</span><span>(b)  </span></span></li><li class=""><span>    {  </span></li><li class="alt"><span>        <span class="keyword">if</span><span>(b & 1)  </span></span></li><li class=""><span>        {  </span></li><li class="alt"><span>            ans = (ans + a) % m;  </span></li><li class=""><span>            b--;  </span></li><li class="alt"><span>        }  </span></li><li class=""><span>        b >>= 1;  </span></li><li class="alt"><span>        a = (a + a) % m;  </span></li><li class=""><span>    }  </span></li><li class="alt"><span>    <span class="keyword">return</span><span> ans;  </span></span></li><li class=""><span>}  </span></li><li class="alt"><span>  </span></li><li class=""><span>LL quick_mod(LL a, LL b, LL m)  </span></li><li class="alt"><span>{  </span></li><li class=""><span>    LL ans = 1;  </span></li><li class="alt"><span>    a %= m;  </span></li><li class=""><span>    <span class="keyword">while</span><span>(b)  </span></span></li><li class="alt"><span>    {  </span></li><li class=""><span>        <span class="keyword">if</span><span>(b & 1)  </span></span></li><li class="alt"><span>        {  </span></li><li class=""><span>            ans = multi(ans, a, m);  </span></li><li class="alt"><span>            b--;  </span></li><li class=""><span>        }  </span></li><li class="alt"><span>        b >>= 1;  </span></li><li class=""><span>        a = multi(a, a, m);  </span></li><li class="alt"><span>    }  </span></li><li class=""><span>    <span class="keyword">return</span><span> ans;  </span></span></li><li class="alt"><span>}  </span></li><li class=""><span>  </span></li><li class="alt"><span><span class="datatypes">bool</span><span> Miller_Rabin(LL n)  </span></span></li><li class=""><span>{  </span></li><li class="alt"><span>    <span class="keyword">if</span><span>(n == 2) </span><span class="keyword">return</span><span> </span><span class="keyword">true</span><span>;  </span></span></li><li class=""><span>    <span class="keyword">if</span><span>(n < 2 || !(n & 1)) </span><span class="keyword">return</span><span> </span><span class="keyword">false</span><span>;  </span></span></li><li class="alt"><span>    LL m = n - 1;  </span></li><li class=""><span>    <span class="datatypes">int</span><span> k = 0;  </span></span></li><li class="alt"><span>    <span class="keyword">while</span><span>((m & 1) == 0)  </span></span></li><li class=""><span>    {  </span></li><li class="alt"><span>        k++;  </span></li><li class=""><span>        m >>= 1;  </span></li><li class="alt"><span>    }  </span></li><li class=""><span>    <span class="keyword">for</span><span>(</span><span class="datatypes">int</span><span> i=0; i<Times; i++)  </span></span></li><li class="alt"><span>    {  </span></li><li class=""><span>        LL a = rand() % (n - 1) + 1;  </span></li><li class="alt"><span>        LL x = quick_mod(a, m, n);  </span></li><li class=""><span>        LL y = 0;  </span></li><li class="alt"><span>        <span class="keyword">for</span><span>(</span><span class="datatypes">int</span><span> j=0; j<k; j++)  </span></span></li><li class=""><span>        {  </span></li><li class="alt"><span>            y = multi(x, x, n);  </span></li><li class=""><span>            <span class="keyword">if</span><span>(y == 1 && x != 1 && x != n - 1) </span><span class="keyword">return</span><span> </span><span class="keyword">false</span><span>;  </span></span></li><li class="alt"><span>            x = y;  </span></li><li class=""><span>        }  </span></li><li class="alt"><span>        <span class="keyword">if</span><span>(y != 1) </span><span class="keyword">return</span><span> </span><span class="keyword">false</span><span>;  </span></span></li><li class=""><span>    }  </span></li><li class="alt"><span>    <span class="keyword">return</span><span> </span><span class="keyword">true</span><span>;  </span></span></li><li class=""><span>}  </span></li><li class="alt"><span>  </span></li><li class=""><span>LL pollard_rho(LL n, LL c)  </span></li><li class="alt"><span>{  </span></li><li class=""><span>    LL i = 1, k = 2;  </span></li><li class="alt"><span>    LL x = rand() % (n - 1) + 1;  </span></li><li class=""><span>    LL y = x;  </span></li><li class="alt"><span>    <span class="keyword">while</span><span>(</span><span class="keyword">true</span><span>)  </span></span></li><li class=""><span>    {  </span></li><li class="alt"><span>        i++;  </span></li><li class=""><span>        x = (multi(x, x, n) + c) % n;  </span></li><li class="alt"><span>        LL d = gcd((y - x&


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-16 11:32:12, Gzip enabled