摘要: 头文件 #include<algorithm> 1. 全排列 next_permutation和prev_permutation(升序和降序) 2. 排序 sort(a,a+4) (默认升序) #include<math.h> 平方 pow(a,2) 开方 sqrt(a) 整数绝对值 int c = 阅读全文
posted @ 2022-03-12 14:48 fashion幽佳 阅读(41) 评论(0) 推荐(0)
摘要: 牛客 NC21457 你能活多少秒 顺序结构题 题目描述 一年约3.156*1e7 s,输入年龄,求该年龄秒数 0<age<=200 代码实现 int 型范围 -2147483648~2147483647 (-231 ~ 231-1) 数量级 1e9 #include<iostream> using 阅读全文
posted @ 2022-03-10 21:45 fashion幽佳 阅读(36) 评论(0) 推荐(0)
摘要: 牛客 NC21992 浮点除法 顺序结构题 题目描述 输入两个整数a, b, 输出a除以b的值,保留三位小数 代码实现 注意输入为整数,输出为浮点数,需要用到变量类型的强制转换 #include<iostream> using namespace std; int main() { int a,b; 阅读全文
posted @ 2022-03-10 19:44 fashion幽佳 阅读(162) 评论(0) 推荐(0)
摘要: 牛客·NC18929·排列式·顺序结构题 题目描述 7254 = 39 x 186 这个式子中1-8每个数字正好出现一次, 输出所有这样不同的式子(乘数交换被认为是相同的式子)结果小的先输出 题目分析 可以发现9个数字只能出现 4 = 4 x 1 4 = 3 x 2 两种请况 将a[9] = {1, 阅读全文
posted @ 2022-03-09 20:22 fashion幽佳 阅读(225) 评论(0) 推荐(0)