10 2024 档案
摘要:#include<bits/stdc++.h> using namespace std; int main() { int n,ans = 0; //ans次数 cin >> n; while(n != 495) { int a = n % 10; //个位 int b = n / 10 % 10;
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; // n % 10 得到n的个位数 // n / 10 去除n的个位数 //1.不断的分割出一个数的个位数 //2.当分割的数不为零,执行循环 int main() { int n,sum = 0; cin >
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int sum = 0; //统计位数 while(n != 0) { sum++; n /= 10; //每分割一位数就统计位数+1 } cout
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; int main() { int n;cin >> n; int ans = 0,k = 0,h = 1; //ans当前前进的距离,k天数,h是一次可以前进的距离 while(ans < n) { ans +
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; int main() { int minn = 9999999,i = 1,n; //最小值minn,循环变量i cin >> n; while(i <= n) //i=1时,写i<=n可以实现循环n次 { i
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; int main() { int maxx = 0,i = 1,n = 5; //最大值maxx,循环变量i while(i <= n) //i=1时,写i<=n可以实现循环n次 { int x; cin >>
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; int main() { int i = 1,n,maxx = -9999999; //初始化最大值maxx为负数 cin >> n; while(i <= n) { int x; cin >> x; if(x
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; int main() { int sum = 0,i = 1,n; //求和sum,循环变量i cin >> n; while(i <= n) //i=1时,写i<=n可以实现循环n次 { int x; cin
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; int main() { int sum = 0,i = 1,n; //求和sum,循环变量i cin >> n; while(i <= n) //i=1时,写i<=n可以实现让i从1到n变化 { sum =
阅读全文
摘要:#include<bits/stdc++.h> #define ll long long using namespace std; const int N = 1e3+10; // 每个月的天数,2月暂时设为29天,后续会根据闰年和平年调整 int a[13] = {0, 31, 29, 31, 3
阅读全文
摘要:思路分析 1. 定义十全数:十全数是指一个数的各位数字之和等于10的数。 2. 输入处理:程序首先读取一个正整数k,表示需要找到的第k个十全数。 枚举正整数:从1开始,逐个检查每个正整数是否是十全数。 4. 检查函数check: 计算一个数n的各位数字之和。 如果和等于10,返回true,否则返回f
阅读全文
摘要:思路分析 1. 输入处理:程序首先读取地毯的数量n。然后依次读取每张地毯的信息,包括左下角坐标(a, b)和尺寸(c, d),并存储在数组中。 查询点的输入:读取要查询的点的坐标(x, y)。 3. 检查覆盖: 从最后一张地毯开始,依次向前检查每张地毯是否覆盖点(x, y)。 检查条件是:x在地毯的
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e4+10, inf = 0x3f3f3f3f; int a[N], vis[2 * N]; // vis数组用于标记哪些数在集合中 i
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e3+10, inf = 0x3f3f3f3f; int a[N], vis[N]; int n, ans; // 计算函数:根据运算符
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; // 读取输入的两个整数A和I int k = a * b; // 初始化k为A和I的乘积 while (1) { // 无限循环,直
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e3+10,inf = 0x3f3f3f3f; int main() { int x,y,z,n,m; cin >> x >> y >>
阅读全文
摘要:#include<bits/stdc++.h> #define ll long long using namespace std; const int N = 1e3+10; int c; bool check(int a,int b) { if(a + b <= c) return 0; //不构
阅读全文
摘要:#include<bits/stdc++.h> #define ll long long using namespace std; const int N = 1e3+10; bool check(int x) { int sum = 0,m = x; //分割m,然后计算次方和sum while(
阅读全文
摘要:#include<bits/stdc++.h> #define ll long long using namespace std; const int N = 1e3+10; int main() { for(int i = 100; i <= 999; i++) { //判断i是水仙花数 int
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; int main() { int a,b,maxx = 0,ans; //maxx是最大上课时间,ans是最不开心的一天 for(int i = 1; i <= 7; i++) { cin >> a >> b;
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5+10,inf = 0x3f3f3f3f; struct node{ int t,p,f; }; node a[N]; int n,
阅读全文