- 博客(34)
- 收藏
- 关注
原创 READ ME FIRST!!!
这里的文章是scut acm队日常训练题解。 因博主是scut大一新生,没有noip经验,所以写出来的代码比较稚嫩,也用不出多高级的数据结构和算法。 但我会好好努力下去,冲刺2个月后新生杯的比赛。 题解中的源代码大部分都是本人打的,少数几题我A不了,但强迫症让我发完所有题的题解,所以只能搬运神犇的代码了orz,会说明的! 我会把题解坚持下去,目前的训练还比较水,以后等题目难度提高了,题解也
2017-09-22 15:32:57 342
原创 Codeforces goodbye 2018
contest链接: https://codeforces.com/contest/1091 A题超级简单 int y,b,r; int main() { scanf("%d%d%d",&y,&b,&r); printf("%d\n",3*(min(min(y+1,r-1),b))); return 0; } B题就是说给出n个A...
2018-12-31 08:59:18 391
原创 SCUT Training 20170920 Problem P
原题:http://acm.hdu.edu.cn/showproblem.php?pid=6043 思路: 一开始我以为这题可以纯模拟,发现TLE,于是打表发现有规律,和b有关 讲道理,模拟看上去肯定更科学点啊 源代码: #include #include #include #include using namespace std; typedef long lo
2017-09-22 15:23:01 212
原创 SCUT Training 20170920 Problem O
原题:http://codeforces.com/contest/589/problem/I 思路: 水题,把每种编号缺少数量加起来就行 源代码: #include #include #include using namespace std; int a[110]; int main() { int n,m,mm,i,j,k; while(sc
2017-09-22 15:18:11 200
原创 SCUT Training 20170920 Problem N
原题:http://codeforces.com/gym/100307/problem/F Problem F 思路: 题目又臭又长,直接看样例就知道要干什么了。逐一检查就行 源代码: #include #include #include #include using namespace std; string stand,tmp; string ans
2017-09-22 15:13:51 163
原创 SCUT Training 20170920 Problem M
原题:http://codeforces.com/gym/100519/problem/D Problem D 思路: 没营养,试两遍就行了 源代码: #include #include #include int a,b=0; double c,tmp; int main() { scanf("%d%d",&a,&b); c=sqrt(b*
2017-09-22 15:11:17 225
原创 SCUT Training 20170920 Problem L
原题:http://codeforces.com/gym/100863/problem/C Problem C 思路: 这题翻译一下就是:给出一个数列的前两项a[1],a[2],通项公式为:a[n]=a[n-2]-a[n-1]。输出数列中第一个负数以及它的下标。若没有则输出两个0. 这道题我能过纯粹靠运气。做题的时候觉得a[n]全>=0的数列是不存在的,然而第四个点TLE了。所以我
2017-09-22 12:54:05 185
原创 SCUT Training 20170920 Problem K
原题:http://codeforces.com/gym/101409/problem/A Problem A 思路: 看懂就秒杀了 源代码: #include //K #include #include using namespace std; double a,b,c,d=0; int test,n=0; double maxx,tmp=0; int
2017-09-22 12:52:03 189
原创 SCUT Training 20170920 Problem J
原题:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1091 思路: 原本我犯懒打算暴力,结果最后一个测试点TLE了。贪心其实是最好的 源代码: 代码是某个大佬的源码,这种红黑树的操作我还不太会用,反正比我的方法好很多 #include #include #include #incl
2017-09-22 12:42:29 170
原创 SCUT Training 20170920 Problem I
原题:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1087 思路: 打表找规律,某些同学居然模拟简直失了智 源代码: #include int n,k,tmp,count1; int main() { scanf("%d",&n); for (int i=1;i;i++
2017-09-21 22:37:28 231
原创 SCUT Training 20170920 Problem H
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2052 思路: 没有思路,这个题也太福利了,我都不太想po这个题上来。注意输出。 源代码: #include H int n,m=0; int main() { while (~scanf("%d%d",&n,&m)) { for (int
2017-09-21 22:34:52 151
原创 SCUT Training 20170920 Problem G
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2043 思路: 水题,没什么好说的 我承认那个if语句写得真的丑,省时间而已= = 源代码: #include #include #include int main() { int n, N; char arr[60]; scanf("%d\n",
2017-09-21 22:31:31 161
原创 SCUT Training 20170920 Problem F
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2034 思路: 这个题我隔了很久才回来写,主要是因为不会用stl库里面的轮子,只能排序做了(要多读书! 题目本身不难,代码写得有点丑,主要是罚时太长了很难受 源代码: #include #include #include int main() { int m,
2017-09-21 22:27:05 162
原创 SCUT Training 20170920 Problem E
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2031 思路: 之前的题解有类似的题,注意负数和数据范围就可以了 源代码: #include int m[1001]={}; int k,p=0; __int32 a; bool flag=false; int check() { if (p==0 && m[1]
2017-09-21 22:24:02 211
原创 SCUT Training 20170920 Problem D
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2028 思路: 我在上一次training题解里发过类似的题,都是用欧几里得定理做的。这次把函数写得清晰点,其实没差。 源代码: #include int gcd(int a,int b) { int i; while (a%b) {
2017-09-21 22:21:07 196
原创 SCUT Training 20170920 Problem C
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2024 思路: 字符串第一个只能是下划线和字母,后面只能是下划线、字母和数字。逐位检查就可以了。 源代码: #include #include #include using namespace std; int main() { int n,i,len,b;
2017-09-21 22:18:02 166
原创 SCUT Training 20170920 Problem B
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2021 思路: 水题,对于每份工资,尽量给大钞,统计钞票数量就可以了 源代码: #include //B int n,ans=0; int a[101]={}; int mon[7]={0,100,50,10,5,2,1}; void find(int x) { i
2017-09-21 22:14:41 129
原创 SCUT Training 20170920 Problem A
这次是第二次比较大的training,明天下午更新完后周末我会打一下去年新生杯的题 原题:http://acm.hdu.edu.cn/showproblem.php?pid=2018 思路: 直接模拟,数组下标是牛的岁数(>=4岁的都放在a[4]),循环计算输出即可 某些同学搞什么记忆化递归,就是把水题搞复杂了 源代码: #include //A #inc
2017-09-21 22:08:44 265
原创 SCUT Training 20170913 Problem P
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2561 思路: 不明白把这个题放在最后是什么意思,水得很,sort一次直接输出第二位就行了。注意sort对数组操作时默认是从0开始的(貌似可以设置,左边参数可以弄成a+1,这里比较懒) 源代码: #include #include using namespace std;
2017-09-13 11:19:37 188
原创 SCUT Training 20170913 Problem O
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2178 思路: 这个题的题干描述很差,正确的意思是:你要猜到的最大的数字m,即在1到m间的每一个数,你都能在n次内把它猜出来。求m 所以说在最坏的情况下,在1到m间,你最多只要猜log2(m+1)次,所以m=2^n-1,即猜n次,你能猜到的最大的数为2^n-1。这道题就是这么简单 源
2017-09-13 11:14:55 194
原创 SCUT Training 20170913 Problem N
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2073 思路: 注意节点的位置并不一定是一前一后,判断前后的方法就是把节点各自xy坐标加起来判断大小即可,每移动一次ans+=sqrt(2)。换行时用勾股定理求即可。 源代码: #include #include int n,a,b,x,y,sum1,sum2; doubl
2017-09-13 11:11:06 207
原创 SCUT Training 20170913 Problem M
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2023 思路: 没什么好说的,题目怎么说怎么算就行 源代码: #include int main() { int n,m,score[50][5],num; while(scanf("%d%d",&n,&m)!=EOF) { double
2017-09-13 11:09:28 208
原创 SCUT Training 20170913 Problem L
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1877 思路: 简单的十进制转任意进制,要注意a+b=0的坑爹情况 源代码: #include int m[1001]={}; int k,p=0; long long a,b; int check() { if (p==0&&m[1]==0) return 1;e
2017-09-13 11:02:13 225
原创 SCUT Training 20170913 Problem K
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2032 思路: 常规杨辉三角,定义一个二维数组可以免去繁琐的计算。空间并不算大。注意最后要空一行即可。 源代码: #include using namespace std; int main() { int n,i,j; int a[31][31];
2017-09-13 10:58:06 198
原创 SCUT Training 20170913 Problem J
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1019 思路: 这个题只是求最小公倍数,用欧几里得定理,先求两个数的最小公倍数,再依次求下去即可。 源代码: #include using namespace std; int LCM(int m,int n) { int dividend,divisor,r;
2017-09-13 10:23:55 172
原创 SCUT Training 20170913 Problem I
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2161 思路: 判断质数而已,注意2在这题是不算质数的。 源代码: #include #include using namespace std; int counter=0; int n,lim; bool out=false; int main() { whi
2017-09-13 10:22:24 139
原创 SCUT Training 20170913 Problem H
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2153 思路: 这种题就是打表找规律,没什么意思,注意数字占3位即可 源代码: #include int main() { int n,i,j; while (scanf("%d", &n)!=EOF && n>=1 && n10) {
2017-09-13 10:13:37 206
原创 SCUT Training 20170913 Problem G
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2016 思路: 读入数据,线性遍历一遍找出最小值,交换输出即可。 为了使代码清晰,写了一个空函数。 源代码: #include #include using namespace std; int a[101]={}; int n=0; string s={}; voi
2017-09-13 10:10:19 160
原创 SCUT Training 20170913 Problem F
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2004 思路: 简单的if语句即可 源代码: #include int main() { int a; while (scanf("%d",&a)!=EOF) //也可以写成~scanf("%d",&a),更方便 { if (a>100
2017-09-13 10:08:04 172
原创 SCUT Training 20170913 Problem E
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2567 思路: 水题。读入两个字符串,第一个输出前半部分,输出第二个,再输出第一个的后半部分。 因为string下标从0开始,要注意循环条件。 整道题废话真多。 源代码: #include #include #include int main() { char
2017-09-13 10:00:21 156
原创 SCUT Training 20170913 Problem D
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1008 思路: 水题。每行数据先读入n,再读入要停留的层数。注意电梯向上向下运行的时间不相等,最后一层也要停留即可。 源代码: #include using namespace std; int main() { int n,a[100],i=0,sum=0;
2017-09-13 09:45:46 172
原创 SCUT Training 20170913 Problem C
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1013 思路: 题干的意思很简单,即把每一位数加起来,until 源代码: #include #include #include int main() { char str[10000]; while (scanf("%s", str) != EOF)
2017-09-13 09:36:37 149
原创 SCUT Training 20170913 Problem B
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1012 思路: 水题,注意一开始的输出和n==0、n==1、n==2时小数点位数。每次计算求和后输出即可。 源代码: #include int main() { int n,b; double e=2.00,a=1.00; printf("n e\n")
2017-09-13 09:19:16 159
原创 SCUT Training 20170913 Problem A
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1004 思路: 水题,定义一个struct类(包含一个名为name的string类和名为count的int类)并定义栈,用p记录栈顶元素的位置。逐行读入并按线性顺序比较,若名字相同则a[i].count++;反之p++并记录名字和次数。最后输出最大的即可。 源代码: #inclu
2017-09-13 09:11:03 206
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人