求助#5
查看原帖
求助#5
691542
封禁用户楼主2022/6/15 12:32

Rt,一直过不去

#include <stdio.h>
#include <string.h>
#define int long long
namespace fast_io{
	static bool _f;
	static int _x,len,_c;
	static const int Buf_size=1<<25,char_size=25;
	static char F[char_size];
	static char obuf[Buf_size],*p3=obuf;
	static char buf[Buf_size],*p1=buf,*p2=buf;
	static const int space=' ',enter='\n';
	static const int fu_hao='-',char_zero=48,char_nine='9';
	#define isdigit(c) (char_zero<=_c&&_c<=char_nine)
	#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,Buf_size,stdin),p1==p2)?EOF:*p1++)
	#define putchar(x) (p3-obuf<Buf_size)?(*p3++=x):(fwrite(obuf,p3-obuf,1,stdout),p3=obuf,*p3++=x)
	inline int read(){
		_x=0;_c=getchar();
		while(!isdigit(_c))
			_c=getchar();
		while(isdigit(_c))
			_x=(_x<<3)+(_x<<1)+(_c^char_zero),
			_c=getchar();
		return _x;
	}
	inline int readn(){
		_f=false;
		_x=0;_c=getchar();
		while(_c!=fu_hao&&!isdigit(_c))
			_c=getchar();
		if(_c==fu_hao){
			_f=true;
			_c=getchar();
		}
		while(isdigit(_c))
			_x=(_x<<3)+(_x<<1)+(_c^char_zero),
			_c=getchar();
		return _f?-_x:_x;
	}
	inline void out(int x){//end with space
	    if(!x){
			putchar(char_zero);
			return;
		}
		if(x<0){
			putchar(fu_hao);
			x=-x;
		}
		len=0;
		while(x)
			F[len++]=x%10^char_zero,
			x/=10;
		while(len--)
			putchar(F[len]);
		putchar(space);
	}
	inline void write(int x){//end with enter
	    if(!x){
			putchar(char_zero);
			return;
		}
		if(x<0){
			putchar(fu_hao);
			x=-x;
		}
		len=0;
		while(x)
			F[len++]=x%10^char_zero,
			x/=10;
		while(len--)
			putchar(F[len]);
		putchar(enter);
	}
}using namespace fast_io;
bool flag,_;
signed f[10000005];
signed main(){
//	freopen("wave.in","r",stdin);
//	freopen("wave.out","w",stdout);
	int t,a,b,c,d,e,i,j;
//	t=read();
//	while(t--){
		flag=false;
//		memset(f,0,sizeof f);
		long long k;
		a=read();b=read();c=read();d=read();e=read();
		for(i=a;i<=b;++i){
			for(int a=1;a<i;++a)
				for(int b=0;b<i;++b){
					if(a==b)
						continue;
					k=a*i+b;
					_=true;
					while(k<=d){
						++f[k];
						k*=i;
						k+=_?a:b;
						_=!_;
					}
				}
		}
		for(i=c;i<=d;++i)
			if(f[i]==e)
				write(i);
		putchar('\n');
//	}
	fwrite(obuf,p3-obuf,1,stdout);
	return 0;
}

模拟赛时这题教练的数据是过的

2022/6/15 12:32
加载中...