摘要:水题~ 用string特别方便 #include <iostream> #include <cstring> #include <string> #include <sstream> #include <string> #include <cstdio> #include <cmath> #incl
阅读全文
摘要:20分的题居然要预处理素数,记得数组开100005。 这题有个小坑就是输入进去的数是按十进制数判断素数,反转的时候是先把它变成d进制数,再反转,再求其十进制数。 #include<iostream> #include<algorithm> #include<cstdio> #include<cmat
阅读全文
摘要:超级大坑题,无进制范围。 可能超级大,要用ull。 既然这么大,二分来帮忙。 左边要最大,右边是数值。 tag小麻烦,处理看代码。 #include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<str
阅读全文
摘要:水题~ 题目大意每行选一个最大的,套公式就好了 #include <iostream> #include <cstring> #include <string> #include <sstream> #include <string> #include <cstdio> #include <cmat
阅读全文
摘要:题目大意就是10进制转13进制 数据居然只有0到168 超级大水题~ #include <iostream> #include <cstring> #include <string> #include <sstream> #include <string> #include <cstdio> #in
阅读全文
摘要:水题~ 老是忘记数字和字母的ASCII码。 把两个字符串逐一比较,没有的输出(用数组标记是否输出过) #include<iostream> #include<algorithm> #include<cstdio> #include<string.h> #define maxn 105 using n
阅读全文
摘要:这题用string和cin会超时,所以要用char。 2个小知识点。 1.id用int类型,输出时用%06d输出 2.strcmp比较char类型字符串,若str1==str2,则返回零;若str1<str2,则返回负数;若str1>str2,则返回正数。 #include<iostream> #i
阅读全文
摘要:水题~ N为字符串长度,n1=n3为竖着的个数,n2是横着的个数 n1=n3=(N+2-(N+2)%3)/3,也就是向下接近能整出3的数 #include<iostream> #include<algorithm> #include<string.h> #define maxn 100 using
阅读全文
摘要:和之前多项式求和类似,注意筛0和输出即可。水题~ #include <iostream> #include <cstring> #include <string> #include <sstream> #include <string> #include <cstdio> #include <cma
阅读全文
摘要:一开始以为用前缀和做,看了下数据10000,果断放弃。 思考了一下,最大和序列的第一个数必为正数(废话),关键是从头开始的子序列和也必为正数。如果加到某个地方和为负数,我还要你前面这些数何用,不如从后面开始重新选。基于上述思路就可以写出代码了。 #include <iostream> #includ
阅读全文
摘要:水题~ #include<iostream> #include<algorithm> #include<string.h> #define maxn 25 using namespace std; typedef long long ll; char s[maxn],ttime[10]; int m
阅读全文
摘要:开个string数组存数字英文。 因为数为10100,所以和最多为900,int求和就够了。水题~ #include<iostream> #include<algorithm> #include<string.h> #define maxn 25 using namespace std; typed
阅读全文
摘要:因为最多有20个字符,int和long long都不行,所以只能用字符串操作。水题~ #include<iostream> #include<algorithm> #include<string.h> #define maxn 25 using namespace std; typedef long
阅读全文
摘要:水题~ #include <iostream> #include <cstring> #include <string> #include <sstream> #include <string> #include <cstdio> #include <algorithm> #include <vec
阅读全文
摘要:水题~ 最好是把得到所有的幂放在一个数组里,然后排序去重,不过这题的幂最大只有1000,所以这么写了。 一开始没看到保留一位小数,wa了一发,难受。 #include <iostream> #include <cstring> #include <string> #include <sstream>
阅读全文
摘要:这道水题有个巨坑:1000的输出是1,000而不是100,0。因为这个改了一早上代码。 还有一个要注意的是和为0的时候,这个简单。 #include <iostream> #include <cstring> #include <string> #include <sstream> #include
阅读全文