/ Randle /

记录详情

Compile Error

/in/foo.cc:34:1: error: stray '\347' in program
 矩阵快速幂
 ^
/in/foo.cc:34:2: error: stray '\237' in program
 矩阵快速幂
  ^
/in/foo.cc:34:3: error: stray '\251' in program
 矩阵快速幂
   ^
/in/foo.cc:34:4: error: stray '\351' in program
 矩阵快速幂
    ^
/in/foo.cc:34:5: error: stray '\230' in program
 矩阵快速幂
     ^
/in/foo.cc:34:6: error: stray '\265' in program
 矩阵快速幂
      ^
/in/foo.cc:34:7: error: stray '\345' in program
 矩阵快速幂
       ^
/in/foo.cc:34:8: error: stray '\277' in program
 矩阵快速幂
        ^
/in/foo.cc:34:9: error: stray '\253' in program
 矩阵快速幂
         ^
/in/foo.cc:34:10: error: stray '\351' in program
 矩阵快速幂
          ^
/in/foo.cc:34:11: error: stray '\200' in program
 矩阵快速幂
           ^
/in/foo.cc:34:12: error: stray '\237' in program
 矩阵快速幂
            ^
/in/foo.cc:34:13: error: stray '\345' in program
 矩阵快速幂
             ^
/in/foo.cc:34:14: error: stray '\271' in program
 矩阵快速幂
              ^
/in/foo.cc:34:15: error: stray '\202' in program
 矩阵快速幂
               ^
/in/foo.cc: In function 'int main()':
/in/foo.cc:20:13: warning: unused variable 'p' [-Wunused-variable]
 long long n,p,k=0,a,f[2];
             ^
/in/foo.cc: At global scope:
/in/foo.cc:36:17: error: redefinition of 'const long long int maxn'
 const long long maxn=2,mod=1e9+7;
                 ^~~~
/in/foo.cc:2:17: note: 'const long long int maxn' previously defined here
 const long long maxn=2,mod=1e9+7;
                 ^~~~
/in/foo.cc:36:24: error: redefinition of 'const long long int mod'
 const long long maxn=2,mod=1e9+7;
                        ^~~
/in/foo.cc:2:24: note: 'const long long int mod' previously defined here
 const long long maxn=2,mod=1e9+7;
                        ^~~
/in/foo.cc: In function 'const void read(long long int&)':
/in/foo.cc:37:19: error: redefinition of 'const void read(long long int&)'
 inline const void read(long long &a)
                   ^~~~
/in/foo.cc:3:19: note: 'const void read(long long int&)' previously defined here
 inline const void read(long long &a)
                   ^~~~
/in/foo.cc: In function 'const void write(long long int)':
/in/foo.cc:47:19: error: redefinition of 'const void write(long long int)'
 inline const void write(long long a)
                   ^~~~~
/in/foo.cc:13:19: note: 'const void write(long long int)' previously defined here
 inline const void write(long long a)
                   ^~~~~
/in/foo.cc: In function 'int main()':
/in/foo.cc:96:5: error: redefinition of 'int main()'
 int main()
     ^~~~
/in/foo.cc:18:5: note: 'int main()' previously defined here
 int main()
     ^~~~

代码

#include<bits/stdc++.h>
const long long maxn=2,mod=1e9+7;
inline const void read(long long &a)
{
a=0;char c=getchar();
while(c<'0'||c>'9')c=getchar();
while(c>='0'&&c<='9')
{
a=(a<<1)+(a<<3)+c-'0';
c=getchar();
}
}
inline const void write(long long a)
{
if(a>9)write(a/10);
putchar(a%10+'0');
}
int main()
{
long long n,p,k=0,a,f[2];
read(n);
f[0]=1;f[1]=2;
k=1;
for(long long i=3;i<=n;i++)
{
k^=1;
a=f[k^1];
f[k]=(f[k^1]+f[k])%mod;
f[k^1]=a;
}
write(f[k]);
return 0;
}
矩阵快速幂
#include<bits/stdc++.h>
const long long maxn=2,mod=1e9+7;
inline const void read(long long &a)
{
a=0;char c=getchar();
while(c<'0'||c>'9')c=getchar();
while(c>='0'&&c<='9')
{
a=(a<<1)+(a<<3)+c-'0';
c=getchar();
}
}
inline const void write(long long a)
{
if(a>9)write(a/10);
putchar(a%10+'0');
}
long long n;
struct square
{
long long a[2][2];
inline const void init(long long i,long long j,long long l,long long k)
{
a[0][0]=i;a[0][1]=j;
a[1][0]=l;a[1][1]=k;
}
inline const void operator=(const square&b)
{
a[0][0]=b.a[0][0];
a[0][1]=b.a[0][1];
a[1][0]=b.a[1][0];
a[1][1]=b.a[1][1];
}
inline const square operator*(square b)
{
square c;
c.a[0][0]=(a[0][0]*b.a[0][0]%mod+a[0][1]*b.a[1][0]%mod)%mod;
c.a[0][1]=(a[0][0]*b.a[0][1]%mod+a[0][1]*b.a[1][1]%mod)%mod;
c.a[1][0]=(a[1][0]*b.a[0][0]%mod+a[1][1]*b.a[1][0]%mod)%mod;
c.a[1][1]=(a[1][0]*b.a[0][1]%mod+a[1][1]*b.a[1][1]%mod)%mod;
return c;
}
inline const void print()
{
write(a[0][0]);putchar(' ');write(a[0][1]);printf("\n");
write(a[1][0]);putchar(' ');write(a[1][1]);printf("\n");
}
}f,p;
const square fast_pow(square p,long long k)
{
square base,ans;
base=p;
ans.init(1,0,0,1);
while(k)
{
if(k&1)ans=ans*base;
k>>=1;
base=base*base;
}
return ans;
}
int main()
{
read(n);
f.init(1,2,0,0);p.init(0,1,1,1);
f=f*fast_pow(p,n-2);
write(f.a[0][1]%mod);
return 0;
}

信息

递交者
类型
递交
题目
上楼梯(数据原创)
题目数据
下载
语言
C++
递交时间
2019-10-28 11:04:10
评测时间
2019-10-28 11:04:10
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes