C++
xqch12345
这个作者很懒,什么都没留下…
展开
-
3-1 得分 UVa1585
#include <vector>#include <iostream>#include <string>using namespace std;int main(){ string word; cin >> word; int num = 0,t=0; for (int i = 0; i < (int)word.size()...原创 2018-05-20 14:12:17 · 147 阅读 · 0 评论 -
杭电OJ 1003 求和最大连续子序列
#include <iostream>#include <vector>#include <algorithm>using namespace std;int main(){ int T; cin >> T; for (int i = 0; i < T; i++) { int n; cin >> n; ...原创 2018-06-16 21:13:17 · 276 阅读 · 0 评论 -
杭电OJ 1004 求出现次数最多的字符串
#include <string>#include <iostream>#include <vector>#include <map>using namespace std;int main(){ int T; while (cin >> T&&T!=0) { map<string,int>原创 2018-06-16 21:15:28 · 185 阅读 · 0 评论 -
杭电 OJ 1005
#include <iostream>#include <vector>using namespace std;int main(){ int A, B, n; while (cin >> A >> B >> n) { if (A == 0 && B == 0 && n == 0)原创 2018-06-16 21:18:19 · 159 阅读 · 0 评论 -
杭电 OJ 1006 Tick and Tick
开始直接通过概率论计算,精度不够一直WA#include <iostream>using namespace std;int main(){ int D; while (cin >> D&&D != -1) { double result = (360 - D * 3)* (360 - D * 3) / 360.0 / 360.0*100.0...原创 2018-06-16 21:21:42 · 1576 阅读 · 0 评论 -
杭电 OJ 1008 Elevator
#include <iostream>#include <vector>using namespace std;int main(){ int N; while (cin >> N&&N != 0) { int sum = N * 5; vector<int> vec(N); for (int i = 0;...原创 2018-06-16 21:23:58 · 149 阅读 · 0 评论 -
杭电 OJ 1009 FatMouse' Trade
#include <iostream>#include <vector>using namespace std;typedef struct { int J; int F; double pro;}MES;int main(){ int M, N; while (cin >> M >> N) { if (M == -1)...原创 2018-06-16 21:25:37 · 265 阅读 · 0 评论 -
杭电OJ 1012 u Calculate e
#include <iostream>using namespace std;int main(){ cout << "n e" << endl; cout << "- -----------" << endl; double sum = 1.0; cout << 0 <&a原创 2018-06-18 18:19:10 · 230 阅读 · 0 评论 -
杭电OJ 1013 Digital Roots
#include <iostream>#include <string>using namespace std;int main(){ string s; while (cin >> s&&s != "0") { int n=0; for (auto a : s) n += a - '0'; int sum = 0...原创 2018-06-18 18:20:17 · 234 阅读 · 0 评论 -
杭电OJ 1017
#include <iostream>using namespace std;int main(){ int T; cin >> T; for (int i = 0; i < T; i++) { int m, n, num1 = 0; while (cin >> n >> m && (m != 0 || n...原创 2018-06-18 18:21:32 · 428 阅读 · 0 评论 -
杭电OJ 1018 Big Number
斯特林公式原创 2018-06-18 18:24:38 · 209 阅读 · 0 评论 -
杭电OJ 1019 Least Common Multiple
求最小公倍数#include <iostream>#include <vector>using namespace std;int minMul(int a, int b){ if (b < a) swap(a, b); for (int i = a; i >= 1;i--) if (b%i == 0&&a%i==0) {...原创 2018-06-18 18:25:43 · 219 阅读 · 0 评论 -
杭电OJ 1002 大数相加
#include <iostream>#include <string>using namespace std;int main(){ int n; cin >> n; for (int i = 0; i < n; i++) { string a, b; cin >> a >> b; cout <&...原创 2018-06-16 21:11:18 · 532 阅读 · 0 评论 -
杭电OJ 2031 进制转换
#include <iostream>#include <string>using namespace std;int main(){ int N, R; while (cin>>N>>R) { if (N < 0) cout << "-"; string s; N = abs(N); while..原创 2018-05-30 16:18:06 · 598 阅读 · 0 评论 -
杭电OJ 2030汉字统计
#include <iostream>#include <string>using namespace std;char s[10000];int main(){ int T; cin >> T; getchar(); for (int i = 0; i < T; i++) { gets_s(s); int num = 0; ...原创 2018-05-30 16:02:53 · 274 阅读 · 0 评论 -
3-2 分子量 UVa1586
#include <vector>#include <iostream>#include <string>using namespace std;int main(){ string mol="CHON"; string word; cin >> word; int num = 0; vector<int> vec(...原创 2018-05-20 14:15:33 · 211 阅读 · 0 评论 -
3-3 数数字 UVa1225
#include <vector>#include <iostream>#include <string>using namespace std;int main(){ string word; cin >> word; vector<int> num(10); for (auto a : word) num[a - ...原创 2018-05-20 14:17:26 · 144 阅读 · 0 评论 -
3-4 周期串 UVa455
#include <vector>#include <iostream>#include <string>using namespace std;bool is_circle_string(string word, int num){ int n = word.size(); for (int i = 0; i < num; i++) f...原创 2018-05-20 14:19:22 · 126 阅读 · 0 评论 -
3-5 谜题 UVa227
#include <vector>#include <iostream>#include <string>using namespace std;int main(){ vector<vector<char>> map = { { 'T', 'R', 'G', 'S', 'J' }, { 'X', 'D', 'O', 'K'...原创 2018-05-20 14:21:00 · 161 阅读 · 0 评论 -
3-7 DNA序列 UVa1368
#include <vector>#include <iostream>#include <string>using namespace std;int GetMin(vector<int> vec){ int minSer = 0; for (int i = 0; i < 4; i++) { if (vec[i] <...原创 2018-05-20 14:24:48 · 157 阅读 · 0 评论 -
3-8 循环小数 UVa202
#include <vector>#include <iostream>#include <string>using namespace std;int main(){ int a, b; cin >> a >> b; vector<int> res(30001); vector<int> re原创 2018-05-20 14:27:06 · 145 阅读 · 0 评论 -
3-9 子序列 UVa 10340
#include <vector>#include <iostream>#include <string>using namespace std;int main(){ string s, t; cin >> s >> t; int j = 0; int k = 0; for (int i = 0; i < (...原创 2018-05-20 14:28:30 · 145 阅读 · 0 评论 -
3-10 盒子 UVa1587
#include <vector>#include <iostream>#include <string>using namespace std;struct box{ int x, y; bool operator==(const box& rhs) // 操作运算符重载 { return(x == rhs.x) &&...原创 2018-05-20 14:30:43 · 229 阅读 · 0 评论 -
3-11 换抵挡装置 UVa1588
#include <vector>#include <iostream>#include <string>using namespace std;int main(){ vector<int>A = { 2, 1, 1, 1, 1, 1, 1 }; vector<int>B = { 2, 2, 2, 1, 2, 2, 1,...原创 2018-05-20 14:33:07 · 315 阅读 · 0 评论 -
3-12 浮点数 UVa11809
#include <vector>#include <iostream>#include <string>#include <sstream>using namespace std;int main(){ double m, x; int ee; int E[10][30]; double M[10][30]; for (in...原创 2018-05-22 20:36:55 · 186 阅读 · 0 评论 -
第二章习题
习题2-5 分数化小数(decimal) 输入正整数a,b,c,输出a/b的小数形式,精确到小数点后c位。a,b≤10^6,c≤100。输入包括多组数据,结束标记为a=b=c=0。源码://2.5分数化小数#include <stdio.h>#include <time.h> #include <vector> int a, b,c;...原创 2018-05-08 15:48:11 · 182 阅读 · 0 评论 -
杭电OJ 1021 Fibonacci Again
#include <iostream>using namespace std;int main(){ int a[8] = { 1, 2, 0, 2, 2, 1, 0, 1 }; int n; while (cin >> n) { if (a[n % 8]) cout << "no" << endl; else co...原创 2018-06-18 18:27:28 · 181 阅读 · 0 评论