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_16357423_3183.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<cstdio></span><span>  </span></span></li><li class="alt"><span><span class="preprocessor">#include<cstdlib></span><span>  </span></span></li><li class=""><span><span class="preprocessor">#include<cstring></span><span>  </span></span></li><li class="alt"><span><span class="preprocessor">#include<string></span><span>  </span></span></li><li class=""><span><span class="preprocessor">#include<queue></span><span>  </span></span></li><li class="alt"><span><span class="preprocessor">#include<algorithm></span><span>  </span></span></li><li class=""><span><span class="preprocessor">#include<map></span><span>  </span></span></li><li class="alt"><span><span class="preprocessor">#include<iomanip></span><span>  </span></span></li><li class=""><span><span class="preprocessor">#define INF 99999999</span><span>  </span></span></li><li class="alt"><span><span class="keyword">using</span><span> </span><span class="keyword">namespace</span><span> std;  </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> MAX=33;  </span></span></li><li class=""><span><span class="datatypes">int</span><span> mod=2008;  </span></span></li><li class="alt"><span><span class="datatypes">__int64</span><span> array[MAX][MAX],sum[MAX][MAX],temp[MAX][MAX],ans[MAX][MAX];  </span></span></li><li class=""><span><span class="datatypes">int</span><span> n,a,b,v1,v2,t1,t2,m;  </span></span></li><li class="alt"><span>map<<span class="datatypes">__int64</span><span>,</span><span class="datatypes">int</span><span>>hash;  </span></span></li><li class=""><span>  </span></li><li class="alt"><span><span class="keyword">void</span><span> MatrixInit(</span><span class="datatypes">__int64</span><span> a[MAX][MAX],</span><span class="datatypes">bool</span><span> flag){  </span></span></li><li class=""><span>    <span class="keyword">for</span><span>(</span><span class="datatypes">int</span><span> i=0;i<MAX;++i){  </span></span></li><li class="alt"><span>        <span class="keyword">for</span><span>(</span><span class="datatypes">int</span><span> j=0;j<MAX;++j){  </span></span></li><li class=""><span>            <span class="keyword">if</span><span>(flag)a[i][j]=array[i][j];  </span></span></li><li class="alt"><span>            <span class="keyword">else</span><span> a[i][j]=(i == j);  </span></span></li><li class=""><span>        }  </span></li><li class="alt"><span>    }  </span></li><li class=""><span>}  </span></li><li class="alt"><span>  </span></li><li class=""><span><span class="keyword">void</span><span> MatrixAdd(</span><span class="datatypes">__int64</span><span> a[MAX][MAX],</span><span class="datatypes">__int64</span><span> b[MAX][MAX],</span><span class="datatypes">int</span><span> &mod){  </span></span></li><li class="alt"><span>    <span class="keyword">for</span><span>(</span><span class="datatypes">int</span><span> i=0;i<MAX;++i){  </span></span></li><li class=""><span>        <span class="keyword">for</span><span>(</span><span class="datatypes">int</span><span> j=0;j<MAX;++j){  </span></span></li><li class="alt"><span>            a[i][j]=(a[i][j]+b[i][j])%mod;  </span></li><li class=""><span>        }  </span></li><li class="alt"><span>    }  </span></li><li class=""><span>}  </span></li><li class="alt"><span>  </span></li><li class=""><span><span class="keyword">void</span><span> MatrixMult(</span><span class="datatypes">__int64</span><span> a[MAX][MAX],</span><span class="datatypes">__int64</span><span> b[MAX][MAX],</span><span class="datatypes">int</span><span> &mod){  </span></span></li><li class="alt"><span>    <span class="datatypes">__int64</span><span> c[MAX][MAX]={0};  </span></span></li><li class=""><span>    <span class="keyword">for</span><span>(</span><span class="datatypes">int</span><span> i=0;i<MAX;++i){  </span></span></li><li class="alt"><span>        <span class="keyword">for</span><span>(</span><span class="datatypes">int</span><span> j=0;j<MAX;++j){  </span></span></li><li class=""><span>            <span class="keyword">for</span><span>(</span><span class="datatypes">int</span><span> k=0;k<MAX;++k){  </span></span></li><li class="alt"><span>                c[i][j]+=a[i][k]*b[k][j];  </span></li><li class=""><span>            }  </span></li><li class="alt"><span>        }  </span></li><li class=""><span>    }  </span></li><li class="alt"><span>    <span class="keyword">for</span><span>(</span><span class="datatypes">int</span><span> i=0;i<MAX;++i){  </span></span></li><li class=""><span>        <span class="keyword">for</span><span>(</span><span class="datatypes">int</span><span> j=0;j<MAX;++j)a[i][j]=c[i][j]%mod;  </span></span></li><li class="alt"><span>    }  </span></li><li class=""><span>}  </span></li><li class="alt"><span>  </span></li><li class=""><span><span class="keyword">void</span><span> MatrixPow(</span><span class="datatypes">int</span><span> k,</span><span class="datatypes">int</span><span> &mod){  </span></span></li><li class="alt"><span>    MatrixInit(sum,0);  </span></li><li class=""><span>    MatrixInit(temp,1);  </span></li><li class="alt"><span>    <span class="keyword">while</span><span>(k){  </span></span></li><li class=""><span>        <span class="keyword">if</span><span>(k&1)MatrixMult(sum,temp,mod);  </span></span></li><li class="alt"><span>        MatrixMult(temp,temp,mod);  </span></li><li class=""><span>        k>>=1;  </span></li><li class="alt"><span>    }  </span></li><li class=""><span>}  </span></li><li class="alt"><span>  </span></li><li class=""><span><span class="keyword">void</span><span> MatrixSum(</span><span class="datatypes">int</span><span> k,</span><span class="datatypes">int</span><span> &mod){  </span></span></li><li class="alt"><span>    <span class="keyword">if</span><span>(k == 1){MatrixInit(ans,1);</span><span class="keyword">return</span><span>;}  </span></span></li><li class=""><span>    MatrixSum(k/2,mod);  </span></li><li class="alt"><span>    MatrixPow((k+1)/2,mod);  </span></li><li class=""><span>    <span class="keyword">if</span><span>(k&1){</span><span class="comment">//A+(A+A^m)*(A+A^2+...),m=(k+1)/2</span><span>  </span></span></li><li class="alt"><span>        MatrixInit(temp,1);<span class="comment">//temp=A</span><span>  </span></span></li><li class=""><span>        MatrixAdd(sum,temp,mod);<span class="comment">//sum=A+A^m</span><span>  </span></span></li><li class="alt"><span>        MatrixMult(ans,sum,mod);<span class="comment">//ans=(A+A^m)*(A+A^2+...),m=(k+1)/2</span><span>  </span></span></li><li class=""><span>        MatrixAdd(ans,temp,mod);<span class="comment">//ans=A+ans</span><span>  </span></span></li><li class="alt"><span>    }  </span></li><li class=""><span>    <span class="keyword">else</span><span>{</span><span class="comment">//(1+A^m)*(A+A^2+...),m=(k+1)/2</span><span>  </span></span></li><li class="alt"><span>        MatrixInit(temp,0);<span class="comment">//temp=1</span><span>  </span></span></li><li class=""><span>        MatrixAdd(temp,sum,mod);<span class="comment">//temp=1+A^m</span><span>  </span></span></li><li class="alt"><span>        MatrixMult(ans,temp,mod);<span class="comment">//ans=(1+A^m)*(A+A^2+...),m=(k+1)/2</span><span>  </span></span></li><li class=""><span>    }  </span></li><li class="alt"><span>}  </span></li><li class=""><span>  </span></li><li class="alt"><span><span class="datatypes">int</span><span> main(){  </span></span></li><li class=""><span>    <span class="keyword">while</span><span>(scanf(</span><span class="str


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-29 14:58:04, Gzip enabled