摘要: 题目如下: 思路:合理利用多位数分离 代码如下: #include<cstdio> #include<iostream> using namespace std; int f(int x){ int count=0; while(x!=0){ if(x%10==2) count++; x/=10;/ 阅读全文
posted @ 2020-09-24 23:26 miao-xixixi 阅读(126) 评论(0) 推荐(0)
摘要: 1.问题:使用geline的时候要注意前面上一行不能有数据 如果上一行有数据,那么cin会把数字读取走,而留下‘\n’ 那么getline遇到它的结束符(\n)就不会读取 2.解决:使用 cin.ignore(numeric_limits<std::streamsize>::max(),’\n’); 阅读全文
posted @ 2020-09-24 17:40 miao-xixixi 阅读(379) 评论(0) 推荐(0)
摘要: 代码如下: if(x%400==0||x%100!=0&&x%4==0) 阅读全文
posted @ 2020-09-24 16:58 miao-xixixi 阅读(127) 评论(0) 推荐(0)