F.A.Qs Home ProblemSet Status Ranklist Contest LoginRegister
Notice:祝各位Oier新年快乐,Rp++!
大视野在线测评-欢迎您
[ New Thread ]
Problem 1026 >> 新人求助!!!本机ACbzojWA
shinedatasp @ 2017-10-20 21:25:51
[ Quote ] [ Edit ] [ Delete ] 1#
真真真不是骗人的!!!!!!
用hzwer和另外一位dalao的代码拍了十来组了!!!!
都是对的一交就WA
请问本机(NOIlinux)和bzoj的评测环境有什么不同,或者这题有坑点???
qwq qwq
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
#define N 1100
#define eps 1e-8
#define mod 31011
#define INF 2000000000
using namespace std;
int s[200];
int f[200][100];
int dfs(int len,int last,bool shangxian,bool qiandao){
// cout<<len<<" "<<last<<" "<<shangxian<<endl;
if(len==0)return 1;
if(!qiandao&&!shangxian&&f[len][last]!=-1)return f[len][last];
int maxn;
if(!shangxian)maxn=9;
else maxn=s[len];
int res=0;
for(int i=last+2;i<=maxn;i++){
res+=dfs(len-1,i,shangxian&&(i==maxn),0);
}
if(qiandao)for(int i=0;i<=1;i++)res+=dfs(len-1,i,shangxian&&(i==maxn),qiandao&&(i==0));
for(int i=0;i<=last-2;i++){
res+=dfs(len-1,i,shangxian&&(i==maxn),0);
}
if(!shangxian&&!qiandao)f[len][last]=res;
return res;
}
int work(int x){
int len=0;
while(x>0){
s[++len]=x%10;
x/=10;
}
memset(f,-1,sizeof(f));
return dfs(len,0,1,1);
}
int main()
{
freopen("hh.in","r",stdin);
freopen("hh.out","w",stdout);
int a,b;
cin>>a>>b;
cout<<work(b)-work(a-1)<<endl;
return 0;
}
ccc000111 @ 2017-10-21 06:04:32
[ Quote ] [ Edit ] [ Delete ] 2#
你没删freopen……
shinedatasp @ 2017-10-21 08:01:29
[ Quote ] [ Edit ] [ Delete ] 3#
交的时候删惹qwq
并无卵用
Lazer2001 @ 2017-10-23 15:24:47
[ Quote ] [ Edit ] [ Delete ] 4#
emmm,这个代码有问题
Sakura_Lemon @ 2017-10-23 15:51:46
[ Quote ] [ Edit ] [ Delete ] 5#
cout背锅
shinedatasp @ 2017-10-27 21:28:27
[ Quote ] [ Edit ] [ Delete ] 6#
初学数位dp
如果是代码有问题
还望各位dalao不吝赐教!!!!
[Top] [Previous Page] [Next Page]

HOME Back