上一页 1 ··· 9 10 11 12 13
摘要: 1041 考试座位号 (15分) 先附上自己写的辣鸡代码,第一次非常傻,查找输入的id,用了双重for循环 虽然这次数据小体现不出来,但是下次要注意orz #include<iostream> const int maxn = 1005; using namespace std; struct No 阅读全文
posted @ 2020-06-08 09:41 chstor 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 自己写一个划拳的change函数来调用 并且用字符数组来存放输入的字符 最重要的就是一个循环相克 0 1 2 布 石头 剪刀 (k1+1)%3 == k2 为赢 ,反之为输,k1==k2为平 #include<iostream> #include<cstdio> #include<cstring> 阅读全文
posted @ 2020-06-07 17:08 chstor 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 1012 数字分类 (20分) 有个卡点就是A2可能加加减减就为0了,对此进行排查 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; int main() { int n; cin>>n; int 阅读全文
posted @ 2020-06-07 17:03 chstor 阅读(68) 评论(0) 推荐(0) 编辑
摘要: 1008 数组元素循环右移问题 (20分) 本题有个注意点:当m超过n的值时,循环重复,本身取余 #include<iostream> #include<algorithm> #include<vector> using namespace std; int main(){ int n,m; cin 阅读全文
posted @ 2020-06-07 17:01 chstor 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 1046 划拳 (15分) 简单模拟 #include<iostream> using namespace std; int main(){ int n;cin>>n; int ans1=0,ans2=0; while(n--){ int a1,a2,b1,b2; cin>>a1>>a2>>b1>> 阅读全文
posted @ 2020-06-07 16:57 chstor 阅读(59) 评论(0) 推荐(0) 编辑
摘要: 1026 程序运行时间 (15分) 自己错误:double用了%来取余,发现不能用,必须用转换为int来取余 1、先四舍五入来往上进一 2、将总共的秒来分别转换为整时整分整秒 秒转换为整时:ans/3600 其余秒转换为整分:ans%3600/60 总共秒取余转换为整秒:ans%60 #includ 阅读全文
posted @ 2020-06-07 16:53 chstor 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 1016 部分A+B (15分) 先掌握一些十进制的转换 ll sum=0,sum=sum*10+a; while(a!=0){a/=10,a%10...} #include<iostream> using namespace std; typedef long long ll; int main( 阅读全文
posted @ 2020-06-07 16:40 chstor 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 1011 A+B 和 C (15分) 注意点: 题目要求A、B在int范围内(int占32位,取值范围为-2147483648~2147483647(-231~ 231-1)) A+B范围(-230~ 232)就超过了int范围,因此用long long #include<iostream> #in 阅读全文
posted @ 2020-06-07 16:31 chstor 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 1001 害死人不偿命的(3n+1)猜想 (15分) 简单的模拟题,根据题来做就行了 #include<iostream> using namespace std; int main(){ int n; cin>>n; int level=0; while(n!=1){ if(n%2==0){ n/ 阅读全文
posted @ 2020-06-07 16:10 chstor 阅读(35) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13