QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#240294#3241. 最小公倍树Cofe_Milk#WA 6ms11424kbC++17823b2023-11-05 14:18:432023-11-05 14:18:44

Judging History

你现在查看的是最新测评结果

  • [2023-11-05 14:18:44]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:11424kb
  • [2023-11-05 14:18:43]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
//#define int ll
#define endl '\n'
#define fi first
#define se second
#define pii pair<int, int>
#define rep(i,a,n,k) for(int i=a;i<=n;i+=k)
#define per(i,a,n,k) for(int i=a;i>=n;i-=k)
/*·········································*/
const int N = 1e6 + 10;
int l, r;
ll res[N], ans;

void solve()
{
	memset(res, 0x3f, sizeof res);
	cin >> l >> r;
	rep(i,1,r,1)
	{
		ll x = 0;
		rep(j,i,r,i) if(j >= l && j <= r)
		{
			if(!x) x = j;
			else res[j] = min(res[j], x * j / i);
		}
	}
	rep(i,l+1,r,1) ans += res[i];
	cout << ans;
}

signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	int t = 1;
	//cin>>t;
	while(t--) solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 6ms
memory: 11424kb

input:

100000 200000

output:

171354945472486

result:

wrong answer 1st lines differ - expected: '171167496763057', found: '171354945472486'