【发布时间】:2019-06-18 12:16:34
【问题描述】:
This is a problem on codeforces 我已经提交了一个解决方案,我得到了 TLE。 如何删除 TLE
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
unsigned int y, k, n;
set <int> s;
cin >> y >> k >> n;
if (y >= n)
{
cout << -1; return 0;
}
for (int i = y + 1; i <= n; i++)
{
if (i%k == 0)
{
s.insert(i - y);
}
}
if (s.begin() == s.end())
{
cout << -1; return 0;
}
for (auto x : a)
cout << x << " ";
}
【问题讨论】: