土:
输出两个仅包含小写字母,长度为20的相同字符串即可。
你们大喊喊错了!是tǔ,guī,yáo,Kuí,故字符串中包含 tuguiyaokuikangsai 才可成功大喊!
参考代码:
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cout<<"hituguiyaokuikangsai\nhituguiyaokuikangsai";
}
圭:
可能是负数,没想到吧!
剩下就很简单码代码了。不知道 F10 为何还要二分数据 + 手算。
参考代码:
#include <iostream>
#include <climits>
using namespace std;
int main() {
int n;
if (!(cin >> n)) return 0;
int inf_max_i = 0;
bool found = false;
for (int i = 1; i <= n; i++) {
int exp = n - i;
long long val = 1;
bool overflow = false;
for (int j = 0; j < exp; j++) {
val *= i;
if (val > INT_MAX) {
overflow = true;
break;
}
}
if (overflow) {
inf_max_i = i;
found = true;
}
}
if (!found) {
for (int i = -1; i >= -100; i--) {
int exp = n - i;
if (exp % 2 != 0) continue;
long long val = 1;
bool overflow = false;
for (int j = 0; j < exp; j++) {
val *= (-i);
if (val > INT_MAX) {
overflow = true;
break;
}
}
if (overflow) {
inf_max_i = i;
found = true;
break;
}
}
}
cout << "inf " << inf_max_i << endl;
return 0;
}垚
细心的话会发现原题的数据范围被删了。原题的数据范围:,超出数据范围输出 No;
如果 就很离谱,输出 No;
如果一行数据数不等于二,输出 No。
就完了,坑不坑?
参考代码:
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
string line;
vector<string> ans;
while (getline(cin, line)) {
if (line.empty()) continue;
stringstream ss(line);
vector<string> v;
string t;
while (ss >> t) v.push_back(t);
if (v.size() == 1 && v[0] == "0") break;
if (v.size() != 2) {
ans.push_back("No");
continue;
}
long long n, m;
stringstream(v[0]) >> n;
stringstream(v[1]) >> m;
if (n > 0 && m >= 1 && m < n&& n<=1e9)
ans.push_back("Yes");
else
ans.push_back("No");
}
for (int i = 0; i < (int)ans.size(); i++) {
if (i) cout << '\n';
cout << ans[i];
}
return 0;
}㙓
算法难度:黄,代码难度:红。
首先题里有一个超级炒鸡钞机超极超技超记超继大的大坑: 是萝卜, 是空地。但是这对这道题无一点影响,接下来论述:
思考一下,如果你想要保全一个片区的萝卜,你肯定要和偷萝卜的人贴脸。TA 走一步,你走一步把 TA 卡死。如你在 ,TA 在 ,如果这个时候该 TA 走的话,TA 如果走到 ,你就走到 ,TA 如果走到 ,你就走到 。这样,你就把 TA 卡死了,你能保卫一部分萝卜。
想一下可行性。设你的坐标为 ,TA的坐标为 ; 易得当 是奇数时,该你走,否则该 TA 走。 而你与 TA 相邻时, 是奇数时,该你走,故无法如此对 TA 进行防卫,故以上方法不可行。
再想一下,是否能单独保卫一两个萝卜。答案是否定的。因为你不能用你的身躯挡住 TA,你在一个萝卜地与一个空地之间来回走动时,当你走到空地,TA 可以一头走进你的萝卜地中,这样,你的这个萝卜就失守了。以此类推,你的所有萝卜都会被偷光。
结论:你的所有萝卜都会被偷光!!
Have fun with 人类智慧历史上最算法的题目
参考代码:
#include<bits/stdc++.h>
using namespace std;
class FastScanner {
static const int BUFSIZE = 1 << 19;
int idx, size;
char buf[BUFSIZE];
public:
FastScanner() : idx(0), size(0) {}
inline char getChar() {
if (idx >= size) {
size = (int)fread(buf, 1, BUFSIZE, stdin);
idx = 0;
if (size == 0) return 0;
}
return buf[idx++];
}
template<typename T>
bool readInt(T &out) {
char c;
T sign = 1;
T num = 0;
c = getChar();
if (!c) return false;
while (c != '-' && (c < '0' || c > '9')) {
c = getChar();
if (!c) return false;
}
if (c == '-') {
sign = -1;
c = getChar();
}
for (; c >= '0' && c <= '9'; c = getChar())
num = num * 10 + (c - '0');
out = num * sign;
return true;
}
};
class FastOutput {
static const int BUFSIZE = 1 << 19;
int idx;
char buf[BUFSIZE];
public:
FastOutput() : idx(0) {}
~FastOutput() { flush(); }
inline void pushChar(char c) {
if (idx == BUFSIZE) flush();
buf[idx++] = c;
}
template<typename T>
void writeInt(T x) {
if (x == 0) { pushChar('0'); return; }
if (x < 0) { pushChar('-'); x = -x; }
char s[12];
int n = 0;
while (x) {
s[n++] = char('0' + x % 10);
x /= 10;
}
while (n--) pushChar(s[n]);
}
void flush() {
if (idx) {
fwrite(buf, 1, idx, stdout);
idx = 0;
}
}
};
int main() {
FastScanner fs;
FastOutput fo;
int n;
while(1){
fs.readInt(n);
if(n==0) break;
for(int i=1;i<=n;i++){
for(int a,j=1;j<=n;j++){
fs.readInt(a);
}
}
fo.pushChar('0');
fo.pushChar('\n');
}
return 0;
}亢
Hey3_smallZ:一群高调的白客,全都是 zako
首先复制 markdown,能找到这样一句话:
也许 $1919810$ 是某个便签网站的后缀?当然,考虑到有人搞破坏,如果你找到了正确的网址但里面没东西,请找 Hey3_smallZ
所以去 note.ms/1919810 中寻找信息,得到破译表,编个代码,能获得 分
对于彩蛋,你需要足够了解 Hey3_smallZ,知道他十分倾心、眷恋、钟情、爱慕、心仪、挚爱、迷恋、倾慕、珍视、怜惜、心悦、牵挂、痴迷、属意、缱绻、渴慕、笃爱、神往、眷顾、魂牵 ,所以你需要输出 ilovemomoi
参考代码:
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
for (int i = 1; i <= 1919810; i++) {
char c; cin >> c;
char out;
if (c == '@') out = 'a';
else if (c == '6') out = 'b';
else if (c == '(') out = 'c';
else if (c == ')') out = 'd';
else if (c == '3') out = 'e';
else if (c == '=') out = 'f';
else if (c == '9') out = 'g';
else if (c == '#') out = 'h';
else if (c == '!') out = 'i';
else if (c == '?') out = 'j';
else if (c == '<') out = 'k';
else if (c == '|') out = 'l';
else if (c == '%') out = 'm';
else if (c == '^') out = 'n';
else if (c == '0') out = 'o';
else if (c == ':') out = 'p';
else if (c == ',') out = 'q';
else if (c == '~') out = 'r';
else if (c == '$') out = 's';
else if (c == '+') out = 't';
else if (c == '&') out = 'u';
else if (c == '-') out = 'v';
else if (c == '_') out = 'w';
else if (c == '*') out = 'x';
else if (c == '/') out = 'y';
else if (c == '2') out = 'z';
else{
cout<<"ilovemomoi";
return 0;
}
cout << out;
}
return 0;
}赛
可以尝试出:
-1: #17 #26 #27 #50
0: #46
1:
2: #1 #16 #25
3: #12 #15 #31
2147483647: #5 #40
n/2: #33
n/2-1: #18 #41 #49
n/2+1: #20 #24
n/3: #28
n/3-1:
n/3+1: #7 #11 #13 #19 #47
n:
n+2: #14
n-1: #30 #48
n+1: #39
n-2: #35
n*2: #38 #44
n*2+1: #2 #9
n*2-1: #3 #4 #23
n*3: #21
n*3+1: #42 #43 #45
n*3-1: #10 #29 #32
ceil(sqrt(n)): #6 #36 #37
floor(sqrt(n)): #8 #22 #34但出题人十分毒瘤,所有 全部相同,所以你需要把所有数据哈希一下再二分。
二分方法,详见 Have fun with 人类智慧题解
完结撒花✿✿ヽ(°▽°)ノ✿