记录编号 |
343194 |
评测结果 |
AAAAAAAAAA |
题目名称 |
Rabbit Number |
最终得分 |
100 |
用户昵称 |
Kulliu |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.024 s |
提交时间 |
2016-11-08 22:31:30 |
内存使用 |
0.09 MiB |
显示代码纯文本
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cstdio>
#include<vector>
#include<queue>
#include<ctime>
#include<cmath>
#include<list>
#include<map>
#include<set>
using namespace std;
typedef long long LL;
#define F(i,l,r) for(LL i=l;i<=r;i++)
#define D(i,r,l) for(LL i=r;i>=l;i--)
inline int work(LL x) {
int cnt = 0;
while(x)
cnt+=x%10,x/=10;
return cnt;
}
int Main(){
freopen("rabbits.in","r",stdin);
freopen("rabbits.out","w",stdout);
queue<LL>q;
LL l,r,ans=0;
scanf("%lld%lld",&l,&r);
q.push(0);
while(!q.empty()) {
int now=q.front();q.pop();
if(now>r)break;
if(now>=l)ans++;
F(i,0,3){
if(!now&&!i)continue;
LL x=now*10+i,tmp=work(x);
if(tmp*tmp==work(x*x))
q.push(x);
else break;
}
}
printf("%d\n",ans);
}
int start=Main();
int main(){;}