自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(25)
  • 收藏
  • 关注

原创 The SetStack Computer UVA - 12096

虽然这段是AC不了的,但主要还是学习里面STL的使用方法#include <bits/stdc++.h>#define ALL(x) x.begin(), x.end()#define INS(x) inserter(x, x.begin())using namespace std;typedef set<int> Set;map<Set, in...

2019-01-27 16:21:59 105

原创 IP Networks UVA - 1590

#include <iostream>#include <cstdio>#include <cstring>#define _for(i, a, b) for (int i = (a); i < (b); i++)using namespace std;const int W = 8, IPW = 4*W;void printIp(co...

2018-11-30 23:55:33 149

原创 Flooded! UVA - 815

#include <stdio.h>#include <iostream>#include <algorithm>using namespace std;int a[500];int main(){ int m, n, kase = 0; double V; while (cin >> m >> ...

2018-11-30 22:59:43 93

原创 Extraordinarily Tired Students UVA - 12108

#include <iostream>#include <string>#include <set>#define _for(i, a, b) for (int i = (a); i < (b); ++i)using namespace std;struct Stu { int A, B, C;} stus[15];set<...

2018-11-09 17:01:11 99

原创 Squares UVA - 201

还是写得有点啰嗦吧,一开始自己定义的结构体里面有四个变量,结果后面自己在使用的时候发现根本就不需要用到四个,两个就够了...这道题觉得思路还好吧,主要是在题目的说明上面,那里写着的Hij 和 Vij意义是不一样的,应该是Hij 和 Vji,还有就是麻烦的输出格式,这段代码还是可以再做修改的,变得更加简洁。#include <iostream>#include <cst...

2018-11-07 23:46:22 127

原创 Cube painting UVA - 253

这道题相对于其他人来说用的篇幅比较长吧,方法也比较简单暴力,就是将绕x,y,z轴方向旋转的三个函数都写出来,然后还有一个判断的函数,然后就进行4*4+4*4=32次的旋转然后进行判断,里面应该还是有重复的情况,不过并没有去深究。#include <iostream>#include <string>using namespace std;string col...

2018-11-07 17:23:17 85

原创 A Typical Homework (a.k.a Shi Xiong Bang Bang Mang) UVA - 12412

这道题总体还好就是过程挺长的要考虑的东西就多起来了#include <iostream>#include <string>#include <cstring>using namespace std;#define MAX 105#define EPS 1e-5struct student{ string sid; int cid; ...

2018-11-05 22:29:46 101

原创 Spreadsheet Tracking UVA - 512

根据紫书做的,非常佩服作者的思路,我只改了一点点内容第一段代码的思路是直接模拟操作,算出最后的电子表格,然后在最后的查询操作根据电子表格找出对应的单元格#include <iostream>#include <cstring>#include <string>using namespace std;#define maxd 100#def...

2018-11-04 11:51:08 101

原创 Message Decoding UVA - 213

这道题还是对紫书上的做了修改吧,修改后就AC了#include <iostream>#include <cstring>#include <string>using namespace std;int readchar(); // 读取一个非换行字符int readnchar(int c);int readcodes();int co...

2018-11-03 10:46:10 112

原创 The Dole Queue UVA - 133

觉得主要还是开始的时候,两个官员的位置吧,要往前挪一位#include <iostream>#include <cstring>using namespace std;int n, k, m, a[25];int go(int official, int d, int t); // 官员official,d表示顺逆时针(-1表顺时针,1表逆时针),t表...

2018-11-02 21:54:59 81

原创 Hangman Judge UVA - 489

#include <iostream>#include <string>using namespace std;int win, lose;int length, chance, rnd;string s1, s2;void guess(char);int main() { while ((cin >> rnd >> s1 ...

2018-11-02 11:38:04 129 1

原创 Ancient Cipher UVA - 1339

#include <iostream>#include <string>#include <cstring>#include <algorithm>using namespace std;int main() { string s1, s2; int cnt1[26], cnt2[26], flag = 1; while ((c...

2018-11-02 11:16:04 86

原创 VC++6.0中的getline函数的bug

下面是在VC++6.0下编译的#include <iostream>#include <string>using namespace std;int main() { string s; getline(cin, s); cout << s << endl; return 0;}但是运行程序会发现需要按两次回车才会出现结...

2018-11-02 09:55:13 572

原创 Floating-Point Numbers UVA - 11809

根据题意,可以推断出最大值又因为数字的数值过大,所以可以同时求以10为底的对数,即:根据题目要求所以可以根据式子先求出对应的lgv的值,然后根据式子可以推出对M由0到9进行遍历,并求出对应的E值(取整数),计算出对应的lgv值与前面的lgv进行比较,若差值较小(取1e-4)则输出对应的M和E,代码如下#include <iostr...

2018-11-02 00:33:52 106

原创 Kickdown UVA - 1588

这道题固定一块板,然后另一块板分别左移和右移,找出对应的最小值就好了#include <iostream>#include <string>#include <algorithm>using namespace std;int main(){ string s1, s2, s3; int length1, length2; while(c...

2018-11-01 21:24:51 81

原创 Box UVA - 1587

#include <iostream>#include <algorithm>using namespace std; struct pairs{ int w, h;}array[6]; bool cmp(pairs a,pairs b){ if (a.w != b.w) return a.w < b.w; else return a....

2018-11-01 20:30:47 145

原创 All in All UVA - 10340

#include <iostream>#include <string>#include <stack>using namespace std;int main() { string s, t; stack<char> st1, st2; while (cin >> s >> t) { for (int...

2018-10-31 22:02:50 149

原创 Repeating Decimals UVA - 202

觉得这道题主要还是理解停止条件是什么,用两个数组分别存储除数和余数,当出现一组除数和余数存在于数组当中时就出现了循环#include <iostream>#include <vector>using namespace std;int main() { int a, b, flag = 0, length = 0, start = 0; // lengt...

2018-10-31 21:24:15 59

原创 DNA Consensus String UVA - 1368

#include <iostream>#include <string>using namespace std;int m, n; // 行数,列数string strs[50]; // 存储每一行int num = 0;string result; // 存储结果void Counts();int main() { int T; // ...

2018-10-31 08:25:50 66

原创 Crossword Answers UVA - 232

这道题觉得主要还是格式问题吧,Down的输出值还需要按顺序排列,一开始没去想后面才发现,在原基础上改了半天,还好最后AC了#include <iostream>#include <string.h>#include <string>using namespace std;int r, c; // r行和c列int first = 1; /...

2018-10-30 00:37:41 137

原创 Puzzle UVA - 227

这道题...输出格式令人好无语,用c写不下去了,一直AW,心态爆炸改用c++重写,改了贼多次,终于搞定#include <iostream>#include <string>using namespace std;string strs[5];int x, y; // 记录空格的坐标int first = 1; // 判断是否为第一个输出int k...

2018-10-29 22:22:01 62

原创 Periodic Strings UVA - 455

#include <stdio.h>#include <string.h>int PeriodicStrings(const char *);bool equal(const char, const char); // 判断两个字符是否相等int main() { int T; char str[100]; scanf("%d", &T); ...

2018-10-27 14:35:09 77

原创 Digit Counting UVA - 1225

#include <stdio.h>#include <string.h>int counts[15] = {0};void DigitCounting(int n);int main() { int T, n, first = 1; scanf("%d", &T); while (T--) { scanf("%d", &n);...

2018-10-27 14:33:48 83

原创 Molar mass UVA - 1586

#include <stdio.h>#include <ctype.h>const double C = 12.01;const double H = 1.008;const double O = 16.00;const double N = 14.01;double molar();double panduan(char);int main() {...

2018-10-27 14:32:25 86

原创 Score UVA - 1585

#include <stdio.h>#include <string.h>int score(const char * str) { int a = 0, b = 1; for (int i = 0; i < strlen(str); i++) { if (str[i] == 'O') a += b++; else b = 1; }...

2018-10-27 14:29:40 100

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除