12 2023 档案

摘要:upper_bound & lower_bound 是STL库中的函数 upper_bound 返回第一个大于查找值的数 lower_bound 返回第一个大于等于查找值的数 lower_bound( begin,end,num):从数组的begin位置到end - 1位置二分查找第一个大于或等于n 阅读全文
posted @ 2023-12-23 00:11 Green_wang 阅读(16) 评论(0) 推荐(0) 编辑
摘要:函数 字符相关函数 ● isupper():判断一个字符是否是大写字母 ● islower():判断一个字符是否是小写字母 ● isalpha():判断一个字符是否是字母 ● isdigit():判断一个字符是否是数字字符 ● isalnum():判断一个字符是否是数字或字母 字符相关转换函数 ● 阅读全文
posted @ 2023-12-09 18:30 Green_wang 阅读(23) 评论(0) 推荐(0) 编辑
摘要:int _sum(int m){ int x = 0; while (m){ x += m % 10; m /= 10; cnt ++; } return x; } 阅读全文
posted @ 2023-12-08 20:20 Green_wang 阅读(4) 评论(0) 推荐(0) 编辑
摘要:int reverse(int x){ int ans = 0; while (x){ ans *= 10; ans += x % 10; x /= 10; } return ans; } 阅读全文
posted @ 2023-12-07 21:29 Green_wang 阅读(9) 评论(0) 推荐(0) 编辑
摘要:直接封装函数返回string string dec_bin(long long x){ string s = ""; while(x > 0){ int yu = x % 2; s = char(yu + '0') + s; x /= 2; } return s; } 阅读全文
posted @ 2023-12-07 20:12 Green_wang 阅读(6) 评论(0) 推荐(0) 编辑
摘要:通用,一键CV可用 bool prime(int x){ if(x == 1) return false; if(x == 2) return true; for (int i = 2; i * i <= x; i++){ if (x % i == 0) return false; } return 阅读全文
posted @ 2023-12-06 19:14 Green_wang 阅读(12) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示