# 2020牛客暑期多校训练营(第七场)(2020.8.1)

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
int t; cin >> t;
while (t--)
{
int n, m; scanf("%d%d", &n, &m);
vector <int> ans;
while (m != n)
{
if (m > n) swap(m, n);
for (int i = 1; i <= m; ++i) ans.push_back(m);
n -= m;
}
for (int i = 1; i <= n; ++i) ans.push_back(m);
cout << ans.size() << endl;
for (auto &i : ans) printf("%d ", i);
cout << endl;
}
return 0;
}


### D、Fake news

#include <bits/stdc++.h>
using namespace std;
int main()
{
int T;
scanf("%d", &T);
while (T--)
{
long long n;
scanf("%lld", &n);
if (n == 1 || n == 24)  printf("Fake news!\n");
else
{
printf("Nobody knows it better than me!\n");
}
}
}


### H、Dividing

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
int main()
{
ll n, k, sum; cin >> n >> k; sum = n;
for (ll i = 2; i <= k; )
{
ll temp = n / i;
if (temp == 0) break;
ll l = i, r = n / temp;
sum = (sum + ((min(r, k) - l + 1)) % MOD * (temp % MOD)) % MOD;
i = r + 1;
}
for (ll i = 2; i <= k; )
{
ll temp = (n - 1) / i;
if (temp == 0) break;
ll l = i, r = (n - 1) / temp;
sum = (sum + ((min(r, k) - l + 1)) % MOD * (temp % MOD)) % MOD;
i = r + 1;
}
sum = (sum + k - 1) % MOD;
cout << sum << endl;
return 0;
}


H卡了很久。做完H之后D很快就出了。应该先去D再返回看H的。

• 点赞 2
• 评论 1
• 分享
x

海报分享

扫一扫，分享海报

• 收藏 1
• 手机看

分享到微信朋友圈

x

扫一扫，手机阅读

• 打赏

打赏

Lecxcy_Kastreain

你的鼓励将是我创作的最大动力

C币 余额
2C币 4C币 6C币 10C币 20C币 50C币
• 一键三连

点赞Mark关注该博主, 随时了解TA的最新博文
10-24

08-05 52