求助对拍
  • 板块学术版
  • 楼主CuSO4_and_5H2O
  • 当前回复9
  • 已保存回复9
  • 发布时间2022/10/23 09:41
  • 上次更新2023/10/27 06:22:41
查看原帖
求助对拍
231946
CuSO4_and_5H2O楼主2022/10/23 09:41

要求是<=1e18.然后写了个这个生成器:

#include<bits/stdc++.h>
#define max(A,B) (A<B?B:A)
#define min(A,B) (A>B?B:A)
#define bug cout<<"I AK IOI"<<endl;
#define gc getchar
using namespace std;
const int N=1e6;

inline void print(int x) {if (x < 0) putchar('-'), x = -x; if(x > 9) print(x / 10); putchar(x % 10 + '0');}
inline int read(){int res = 0, f = 0; char ch = gc();for(; !isdigit(ch); ch = gc()) f |= (ch == '-'); for(;isdigit(ch);ch=gc()) res = (res << 1) + (res << 3) + (ch ^ '0');return f ? -res :res;}

long long n,k; 

signed main(){
//	freopen("date.in","w",stdout);
	srand(time(0));
	n=(rand()%N+1)*(rand()%N+1)*(rand()%N+1);
	k=(rand()%N+1)*(rand()%N+1)*(rand()%N+1);
	cout<<n<<' '<<k;
}

按道理,最大值就是 1e6 * 1e6 * 1e6,但是几乎每一次都会出现爆long long的情况,为什么?

2022/10/23 09:41
加载中...