Coder

舒心、快乐,比什么都重要

摘要: #include #include using namespace std; int main() { string num; int a, b, m; cin >> num >> m; // 一个为字符串一个为整形数字避免了麻烦的处理 int len = num.size(); a = (num[0] - '0') / m; b ... 阅读全文
posted @ 2019-05-01 00:02 H123K 阅读(173) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; int main() { int n; string s1, s2; getline(cin,s1); getline(cin,s2); int a[128] = {0}; // 建立一个128的字符的数组 for (int i = 0; i < s1.length(); i++)... 阅读全文
posted @ 2019-04-30 21:33 H123K 阅读(182) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; struct s { string id; int dis; } num[10010]; // 结构体数组变量开的大一点 bool cmp (s a, s b) { // 形参中用结构体定义两个结构体变量 return a.dis > n; for (int... 阅读全文
posted @ 2019-04-30 00:09 H123K 阅读(100) 评论(0) 推荐(0) 编辑
摘要: // 建一个判断函数,接受两个整形的变量,再通过循环按位判断相等与否,主体函数中调用被调函数,建立一个判断变量。#include using namespace std; bool cmp (int x, int k) { while (k != 0) { int t1 = x % 10; int t2 = k % 10; if (t1... 阅读全文
posted @ 2019-04-29 20:03 H123K 阅读(228) 评论(0) 推荐(0) 编辑
摘要: #include #include // set 集合中没有重复的元素 using namespace std; int cmp(int t) { int sum = 0; while (t != 0) { sum += t % 10; t /= 10; } return sum; } int main() { in... 阅读全文
posted @ 2019-04-29 08:49 H123K 阅读(110) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; int main() { int n, i, sum = 0, cnt = 0; // 这是为零很重要 string s; int w[17] = { 7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2 }; char z[11] = { '1', '0', '... 阅读全文
posted @ 2019-04-26 12:57 H123K 阅读(444) 评论(0) 推荐(0) 编辑
摘要: // 首先创建一个结构体,再创建三个结构体变量,设定好边界,记录合格人数,进行比较,输出。#include #include using namespace std; struct s { string name, bir; } a, young, old; int main() { int n, cnt = 0; string down = "1814/09/06... 阅读全文
posted @ 2019-04-24 21:03 H123K 阅读(376) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; int arr[1 > n; for (int i = 1; i > x; arr[x] = i; } cin >> m; while (m--) { cin >> y; if (arr[y] == -1) { //... 阅读全文
posted @ 2019-04-24 01:23 H123K 阅读(176) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; int arr[1 > n; for (int i = 1; i > x; t = abs(x - i); arr[t]++; } for (int i = 10000; i >= 0; i--) { if (arr[i] > 1) {. //... 阅读全文
posted @ 2019-04-24 00:39 H123K 阅读(185) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; int main() { int n, m; cin >> n >> m; for (int i = 0; i > g2; for (int j = 0; j > x; if (x >= 0 && x <= m) { s... 阅读全文
posted @ 2019-04-24 00:13 H123K 阅读(153) 评论(0) 推荐(0) 编辑