73 还有什么情况会WA?求助
查看原帖
73 还有什么情况会WA?求助
1050431
DevilsFlame楼主2024/4/30 12:42
#include<bits/stdc++.h>
using namespace std;
int x,y,l,r,k;
int s[10000010];
int main()
{
	ios :: sync_with_stdio(0);
	cin >> x >> y >> l >> r >> k;
	for (int v = x;v <= y;v ++)
	{
		for (int i = 1;i < v;i ++)
		{
			s[i] ++; //判个位数
			for (int j = 0;j < v;j ++)
			{
				if(i != j)
				{
					int h = 0;
					bool e = 0;
					while(h <= l)
					{
						switch(e)
						{
							case 0:
								h = h * v + i;
								break;
							case 1:
								h = h * v + j;
								break;
						}
						e = 1 - e;
						if(h >= l && h <= r && h > 9)//多位数
						{
							s[h] ++;
						}
					}
				}
			}
		}
	}
	for (int i = l;i <= r;i ++)
	{
		if(s[i] == k)
		{
			cout << i << endl;
		}
	}
	return 0;
}
2024/4/30 12:42
加载中...