QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#631402#2934. How Many Unicycles in a Broken WheelTenshiCompile Error//C++231.2kb2024-10-12 02:50:242024-10-12 02:50:24

Judging History

你现在查看的是最新测评结果

  • [2024-10-12 02:50:24]
  • 评测
  • [2024-10-12 02:50:24]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
 
#define debug(x) cerr << #x << ": " << (x) << endl
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define dwn(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define all(x) (x).begin(), (x).end()
 
#define x first
#define y second
using pii = pair<int, int>;
using ll = long long;
 
inline void read(int &x){
    int s=0; x=1;
    char ch=getchar();
    while(ch<'0' || ch>'9') {if(ch=='-')x=-1;ch=getchar();}
    while(ch>='0' && ch<='9') s=(s<<3)+(s<<1)+ch-'0',ch=getchar();
    x*=s;
}

const int N=4040, mod=100007;

int n;
int f[N][2];

int add(int a, int b){
	return (a+b)%mod;
}

int mul(int a, int b){
	return 1LL*a*b%mod;
}

int get(int x){
	if(!x) return 1;5
	return add(f[x][0], f[x][1]);
}

signed main(){
	cin>>n;
	--n;
	
	f[1][0]=1;
	f[1][1]=1;
	rep(i, 1, n-1){
		f[i+1][0]=add(f[i+1][0], mul(2, f[i][0]));
		f[i+1][1]=add(f[i+1][1], f[i][0]);
		f[i+1][0]=add(f[i+1][0], f[i][1]);
		f[i+1][1]=add(f[i+1][1], f[i][1]);
	}
	
	int res=0;
	rep(l, 1, n) rep(r, l+1, n){
		int fir=l-1;
		int sec=n-r;
		res=add(res, mul(get(fir), get(sec)));
	}
	cout<<res;
		
	return 0;
}

詳細信息

answer.code: In function ‘int get(int)’:
answer.code:37:26: error: expected ‘;’ before ‘return’
   37 |         if(!x) return 1;5
      |                          ^
      |                          ;
   38 |         return add(f[x][0], f[x][1]);
      |         ~~~~~~            
answer.code:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^