摘要: #include<bits/stdc++.h> using namespace std; int main(){ int n; while(cin>>n){ if(n == 0) return 0; int ans = 0, cnt = 0; vector<int> a(n); for(auto& 阅读全文
posted @ 2024-02-07 12:39 Yoloerr 阅读(10) 评论(0) 推荐(0)
摘要: #include<bits/stdc++.h> #include<math.h> using namespace std; int main(){ string s; while(getline(cin,s)){ float cnt = 0; int cc = 0; int flag = 1; fo 阅读全文
posted @ 2024-02-06 11:14 Yoloerr 阅读(12) 评论(0) 推荐(0)
摘要: #include<stdio.h> int main(){ int a,b; while(scanf("%d %d",&a,&b) != EOF){ if(a == '\n' || b == '\n') return 0; printf("%d\n",a+b); } return 0; } 关键:这 阅读全文
posted @ 2024-02-04 22:42 Yoloerr 阅读(15) 评论(0) 推荐(0)
摘要: 有时候输入时候就可以解决处理问题,比如下面这种做法: 记得这种写法: 这个写法算的是从1 到 x 。 当无法判断有多少个输入样例时候,持续输入的大条件可以是: 赋值可以这么写: 这样就能避免赋值错误 for语句实际上是遍历一个集合,上图是遍历字符串 阅读全文
posted @ 2023-09-27 14:58 Yoloerr 阅读(13) 评论(0) 推荐(0)
摘要: if 之后想直接跳开不执行的话用 : pass 就可以。 python 中变量都是可以全局使用的: 与或非 and or not else if 在python中是 elif 两数比较 简写方法 想输出一个符号有时候需要敲两个上去: 阅读全文
posted @ 2023-09-24 10:29 Yoloerr 阅读(6) 评论(0) 推荐(0)
摘要: 赋值方法: 字符串拼接 中间 要加+号 python 中的除法是浮点数除法 整除是 // 是向下取整,而不是向0取整 2 ** 3 代表2的3次方 类型转换方法,非输出语句中,字符串只能与字符串一起 拼接 输入:input() 默认类型是个 str,需要强制转换为 int 输入多个数的方法:#spl 阅读全文
posted @ 2023-09-04 21:23 Yoloerr 阅读(14) 评论(0) 推荐(0)
摘要: 7.26 1 . 一次输入多个数字 1 # 一次性输入两个数字,并用空格分隔它们 2 num1, num2 = map(float, input("请输入两个数字,用空格分隔: ").split()) 3 4 # 计算两个数字的和 5 sum_result = num1 + num2 6 7 # 打 阅读全文
posted @ 2023-07-27 01:03 Yoloerr 阅读(42) 评论(0) 推荐(0)