题解
Trivial_std · · 个人记录
J judging
写在前面
为什么J题被第一个封掉了qwq。
20分是如何骗到的?
解法
当你试着交一发并获得WA后你会因SPJ看到提示:
ask uaece7av for help
根据提示打开https://www.luogu.me/paste/uaece7av
这是本题交互库,不难看出这就是P1733 猜数(IO交互版)
代码:
#include <cstdio>
#include <iostream>
int main() {
for (int l = 1, r = 1000000000, mid = (l + r) >> 1, res; l <= r; mid = (l + r) >> 1) {
std::cout << mid << std::endl;
std::cin >> res;
if (res == 0) {
return 0;
} else if (res == -1) {
l = mid + 1;
} else if (res == 1) {
r = mid - 1;
} else {
puts("OvO, I AK IOI"); // this statement will never be executed.
}
}
return 0;
}
K 过去之题
解法
1.根据提示中的Find in IDTBC012 找到IDTBC012中我出的题U531245 A gcd problem
2.各交一发AC和UNAC。 得到分数,时间(总),内存(总):
||分数|时间|内存| |:-:|:-:|:-:|:-:| |AC|77|121|116| |UNAC|104|105|99|
3.将Ascall值转换为字符按题目要求拼接起来得到单词'Mythic'(记得大写M)。
输出即可。
L 阶乘之迷
解法与思路
题目看似需要计算超大规模阶乘和,但存在以下关键性质:
- 当
k ≥ 15时,k!的质因数分解中至少包含 3 个 2 和 3 个 5(因为15! = 1307674368000),因此k! mod 1000 = 0。 - 所以,如果
n \le 14 ,直接暴力即可,否则,输出313。
代码
#include <iostream>
using namespace std;
const int CUTOFF = 14;
const int MOD = 1000;
int main() {
long long n;
cin >> n;
if (n >= CUTOFF) {
cout << 313;
} else {
int sum = 0, fact = 1;
for (int i = 1; i <= n; i++) {
fact = (fact * i) % MOD;
sum = (sum + fact) % MOD;
}
cout << sum;
}
return 0;
}
M 数列
思路
数列中的数字为六位数,看着像题号。
于是我们在团队题库中找到这样的题:
题号分别为: 511549 511550 511553 511554 511556
输出:
511551 511552 511555
注意时限和内存,不要超时哟~
代码
#include<bits/stdc++.h>
using namespace std;
signed main()
{
printf("511551 511552 511555");
}