编辑
2023-10-24
后端
00
  1. 验证密码有效性的函数:
go
import "regexp" // 密码必须包含至少一个大写字母、一个小写字母、一个数字,长度在 8 到 16 个字符之间 func IsPasswordValid(password string) bool { pattern := `^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,16}$` match, _ := regexp.MatchString(pattern, password) return match }
编辑
2023-10-24
数据结构与算法
00
cpp
#include <iostream> #include <vector> using namespace std;
编辑
2023-10-24
算法题
00
cpp
#include <iostream> #include <cstdio> usin
编辑
2023-10-22
数据结构与算法
00

P1319

cpp
#include<cstdio> #include<iostream> #include<cstring> using namespace std; int n,a,tot,sum; int main() { int tot = 0; scanf("%d",&n); while(scanf("%d",&a) != EOF)//输入 { if(tot % 2 == 0)//到输出0这个操作 { for(int i = 1;i <= a;i++) { printf("0"); sum++;//记录一行的个数,不能超过n个 if(sum == n)//如果超过n个,就换行 { printf("\n"); sum = 0; } } tot++;//下一个操作 } else//反之 { for(int i = 1;i <= a;i++) { printf("1"); sum++; if(sum == n) { printf("\n"); sum = 0; } } tot++; } } return 0; }
编辑
2023-10-22
动漫
00