跳到正文

个人记录

验证码校验 题解

cjZYZtcl约 2 分钟
原文
文章信息与版本

文章信息

发布
2021年9月25日
收录
2026年2月21日
更新
2026年11月9日
篇幅
约 2 分钟

版本

  1. v1当前

字符串入门题。

判断 qq 的值,然后对于不同情况单独处理即可。

Code:

C++
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read(){
	int x = 0, m = 1;
	char ch = getchar();
	while(!isdigit(ch)){
		if(ch == '-') m = -1;
		ch = getchar();
	}
	while(isdigit(ch)){
		x = x * 10 + ch - 48;
		ch = getchar();
	}
	return x * m;
}
inline void write(int x){
	if(x < 0){
		putchar('-');
		write(-x);
		return;
	}
	if(x >= 10) write(x / 10);
	putchar(x % 10 + '0');
}
signed main(){
	int t = read(), q = read();
	while(t--){
		string s, s1;
		cin>>s>>s1;
		if(q == 1){
			if(s == s1) puts("Yes");
			else puts("No");
		}
		else{
			for(int i = 0; i < s.size(); i++){
				if(s[i] >= 'A' && s[i] <= 'Z'){
					s[i] = s[i] - 65 + 97;
				}
				if(s1[i] >= 'A' && s1[i] <= 'Z'){
					s1[i] = s1[i] - 65 + 97;
				}
			}
			if(s == s1) puts("Yes");
			else puts("No");
		}
	}
}
原文
存档评论2 条抓取于