东莞网站建设企慕,程序员做情侣网站 礼物,电子商务网站开发基本流程图,郴州网站seo优化这次比赛原本就是来打酱油的#xff0c;想做个签到题就走#xff01;一开始不知道1002是签到题#xff0c;一直死磕1001#xff0c;WA了四发过了#xff0c;回头一看Rank#xff0c;三十名#xff0c;我靠#xff01;看了1001的AC率#xff0c;在我AC之前只有一个人AC… 这次比赛原本就是来打酱油的想做个签到题就走一开始不知道1002是签到题一直死磕1001WA了四发过了回头一看Rank三十名我靠看了1001的AC率在我AC之前只有一个人AC了当时我AC了1001感觉松了口气终于算是签到了看AC率1%吓死宝宝了我啥时候变得这么屌了连我们学校的大佬都没AC出来被我这样一个菜鸡给AC了顿时感觉信心回来了然后我的电脑上插了一个气球莫名其妙还有气球回头看1002我靠WA了三发什么情况10^9肯定超时WA了一发原本想什么快速幂弄出来我真是傻了眼又WA了两发我静下心来想想人家最快27秒AC不可能很复杂结果再读了一遍题目被坑啦就总共两种情况n0和n0的情况然后AC了Rank 15~~然后1005我就不说了估计是没有想清楚WA了5发最后Rank 21结束没办法咯好好学吧为了自己的未来加油 1001-------------------------------------------------------------------------------------------------------------------------- 三种橙子 Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other) Total Submission(s) : 201 Accepted Submission(s) : 7 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description 江理著名理论AC选手橙子最近在追一个汉子23333不要问我为什么是汉子他为了讨取汉子的开心他准备了若干个三种颜色的橙子分别为红色绿色青色现在他打算把橙子放到桌子上摆放的规则是这样的每个桌子必须放满3个橙子且每个桌子上橙子颜色的数量要求大于等于两种现在给出你各个橙子的数量想问下聪明的你这么多橙子能放多少张桌子。注意一个桌子必须放满橙子才算数 Input 输入a,b,c分别表示红橙子绿橙子青橙子的数量。0≤a,b,c≤2∗109多组输入 Output 最多能放几张桌子 Sample Input 5 4 3
1 1 1
2 3 3 Sample Output 4
1
2对于第一组数据 我们可以划分为
gbb
rgg
brr
rrg
g表示绿苹果,r表示红苹果,b表示青苹果 Author 萌妹纸 思路三个数判断最大的那个是不是大于另外两个和的两倍是输入两个和否则输出三个数相加除以3 下面给出AC代码 1 #include bits/stdc.h2 using namespace std;3 int main()4 {5 long long a,b,c;6 while(scanf(%lld%lld%lld,a,b,c)!EOF)7 {8 long long sabc;9 long long x,y,z;
10 if(ab)
11 {
12 if(ac)
13 {
14 xa;
15 if(bc)
16 yc;
17 else yb;
18 }
19 else xc;
20 }
21 else
22 {
23 if(ac)
24 xb;
25 else
26 {
27 ya;
28 if(bc)
29 xb;
30 else xc;
31 }
32 }
33 zs-x-y;
34 long long ts/3;
35 if (yzxs3)
36 {
37 if(yzt)
38 printf(%lld\n,yz);
39 else printf(%lld\n,t);
40 }
41 else
42 printf(%lld\n,s/3);
43 }
44 return 0;
45 } 1002------------------------------------------------------------------------------------------------------------- 会喊666的咸鱼 Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other) Total Submission(s) : 277 Accepted Submission(s) : 53 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description 江西理工大学竞赛队有一个LOL打的特别好的学长-李俊贤他曾经放出大话他一个人带着4个只会喊666的咸鱼就能打进世界总决赛单杀faker现在他正在为着自己的梦想不断奋斗者解释下他的梦想当然不是单杀faker而是找4条咸鱼现在贤大想了一道问题来考考你们做出来的就可以成为贤大的咸鱼了2333333. Input 输入一个整数n求666的n次方的个位数。多组输入 Output 对于每组输入数据输出结果。 Sample Input 1 Sample Output 6 Author 萌妹纸 思路0的话输出1别的输出6 下面给出AC代码 1 #include bits/stdc.h2 using namespace std;3 int main()4 {5 int n;6 while(scanf(%d,n)!EOF)7 {8 if(n0)9 printf(1\n);
10 else if(n1)
11 printf(6\n);
12 }
13 return 0;
14 } 1003-------------------------------------------------------------------------------------------------------------------- 学妹的告白 Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other) Total Submission(s) : 69 Accepted Submission(s) : 2 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description 一位学妹喜欢萌樱花学长已经好长一段时间了今天很意外在机房遇见萌樱花学长~太过直白反而会吓着学长学妹心里是这么想的于是她想了一个游戏。学长我们玩一个游戏吧“游戏”学长满脸疑问看着她。哎呀是这种的我们现在纸上画一个方框平均分成n份编号为1~n然后呢我们从1号开始移动k个数字如果遇上边界就改变方向就是下面的样子比如8个格子移动两个数字(图片不能正常显示请点击:链接http://pan.baidu.com/s/1eR7AHCQ)1-3-5-7-7-5-3-1-3....如果这样一直跳就会出现死循环不能把每一个格子都踩中那么我们需要最小的k是多少时才能满足每一个格子都踩中呢“那不是等于1么”学长脱口而出~这样就没法玩了难怪都这么久都没有女朋友当然k不能等于1“那我再想一想”刚说完学长就得到了答案学妹失望的走了。“奇怪明明答案是正确的啊怎么不开心呢”真实的故事 Input 输入n表示划分n个格子 2n10^5(多组输入) Output 输出最小的k满足每一个格子都踩中k不等于1 Sample Input 8 Sample Output 31-4-7-6-3-2-5-8 全部踩中 Author 樱花落舞 思路给出两种方案一是打表模拟 给出参考的伪代码 1 int flag[N];2 int check(int x,int n)3 {4 for(int i1;in;i)5 flag[i]0;6 int ans0;7 int st1;8 int dir1;9 while(ansn-1)
10 {
11 if(dir)
12 stx;
13 else
14 st-x;
15 if(st0)
16 st2-st,dir1;
17 else if(stn)
18 st2*n-st,dir0;
19 //coutx xxx stendl;
20 int pst;
21 if(flag[p])return 0;
22 ans;
23 flag[p]1;
24 }
25 return 1;
26 } 下面给出AC代码 1 #include iostream2 #include cstdio3 #include cmath4 #include string5 #include cstring6 #include algorithm7 #include queue8 #include map9 #include set
10 #include stack
11 #include sstream
12 #include vector
13 #define PI acos(-1.0)
14 #define N 111111
15 #define M 1000000007
16 #define inf 1e9
17 #define eps 1e-8
18 #define dazhi 2147483647
19 using namespace std;
20 typedef long long ll;
21 int main()
22 {
23 int a[10] {3,5,7,11,13,17,19,23};
24 int n;
25 while(cinn)
26 {
27 int l3;
28 for(int i0; i7; i)
29 {
30 if(n%l1)
31 l*a[i1];
32 else
33 {
34 printf(%d\n,a[i]);
35 break;
36 }
37 }
38 }
39 } 方案二 如果做过HDU1222题估计会好很多结论就是gcd(2*n-2,k)1时所有格子可以踩中 HDU1222是一个圈啦这里不是我们要看成一个圈比如12321我们取1232为循环就是2*3-22*n-2 下面给出AC代码 1 #include stdio.h2 #include stdlib.h3 #include string.h4 #include math.h5 #include iostream // C头文件C完全兼容C6 #include algorithm // C头文件C完全兼容C7 #include time.h8 #define fre freopen(out.txt,w,stdout) //以文件代替控制台输入比赛时很常用能缩短输入测试样例的时间9 #define INF 0x3f3f3f3f
10 #define inf 1e60
11 using namespace std; // C头文件C完全兼容C
12 const int maxn 200;
13 int a[maxn];
14 int b[3];
15 int ans,n,k;
16
17 int main()
18 {
19 while(cinn)
20 {
21 for(int i2; i2*n; i)
22 {
23 if(__gcd(2*n-2,i)1)
24 {
25 coutiendl;
26 break;
27 }
28 }
29 }
30
31 return 0;
32 } 1004-------------------------------------------------------------------------------------------------------------------------------- 豆豆的三进制计算机 Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other) Total Submission(s) : 31 Accepted Submission(s) : 2 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description 豆豆最近思考计算机为什么要使用二进制的时候突然想到为什么不使用三进制呢。三进制明显更适合人类思维。毕竟三进制可以表示事物的三种状态(真假未知)三进制是以3为基数的进制。和二进制一样三进制的数位称为三进制位trit每个三进制位包含 log23约1.58个二进制位的信息量。通常三进制中使用0、1、2三个数字。n!末尾有多少个0这样的问题对于豆豆来说是非常简单的。豆豆突然想到那么n!转换成3进制后末尾有多少个0呢 Input 一个整数n1n10^18多组数据 Output 输出n!转换成3进制后末尾0的个数 Sample Input 3 Sample Output 1 Author 木木 Source 木木 思路 我们想一想十进制怎么求末尾0嗯嗯当然是找被10整除的个数喽 这里情况一样的啦我们就一直除以3一直除以3找被3整除的个数 下面给出AC代码 1 #include stdio.h2 #define freout freopen(out.txt,w,stdout)3 #define frein freopen(in.txt,r,stdin)4 int main ()5 {6 // frein;7 // freout;8 long long n;9 while(~scanf(%lld, n))
10 {
11 long long sum 0;
12 long long tmp 3;
13 while (n tmp)
14 {
15 sum (n / tmp);
16 tmp * 3;
17 }
18 printf(%lld\n, sum);
19 }
20
21 return 0;
22 } 1005-------------------------------------------------------------------------------------------------------------------------- 袁少的游戏 Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other) Total Submission(s) : 200 Accepted Submission(s) : 24 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description 编故事编的好累懒得编了直接说了给你一个n然后输入n个数问你这n个数可不可以通过部分加上一个数或者减去一个数使所有数都相等这个数是固定的如果可以输出jxust不可以则输出ecjtujxnu Input 输入一个数n1n10^5然后输入n个数。多组输入 Output 输出jxust或ecjtujxnu Sample Input 5
1 3 3 2 1
5
1 2 3 4 5
2
1 2 Sample Output jxust
ecjtujxnu
jxust第一组样例可以通过所有的3都减一所有的1都加一使全部都变成2.所以输出jxust
第三组样例可以让1加上1使所有数都变成2或者让2减去1使所有数都变成1所以输出jxustAuthor 萌妹纸 思路 大概知道了如果数组中只存在两种数字必定是符合要求的 三种如何判断最小的数字必须增加一个数最大的数字必须减少一个数字他们要和中间数字相同那么是a[3]-a[2]a[2]-a[1]的关系 我们需要做的就是去重计算出他的种类排序判断 下面给出AC代码 1 #pragma comment(linker, /STACK:1024000000,1024000000)2 #includeiostream3 #includecstdio4 #includecmath5 #includestring6 #includequeue7 #includealgorithm8 #includestack9 #includecstring
10 #includevector
11 #includelist
12 #includeset
13 #includemap
14 using namespace std;
15 #define ll long long
16 #define pi (4*atan(1.0))
17 #define eps 1e-14
18 #define bug(x) coutbugxendl;
19 const int N1e510,M1e610,inf2147483647;
20 const ll INF1e1810,mod2147493647;
21 ll a[N];
22 int main()
23 {
24 int n;
25 while(~scanf(%d,n))
26 {
27 for(int i1; in; i)
28 scanf(%lld,a[i]);
29 sort(a1,a1n);
30 int cntunique(a1,a1n)-a;
31 //coutcntendl;
32 if(cnt4)
33 printf(ecjtujxnu\n);
34 else
35 {
36 if(cnt3)
37 printf(jxust\n);
38 else if(a[3]-a[2]a[2]-a[1])
39 printf(jxust\n);
40 else
41 printf(ecjtujxnu\n);
42 }
43 }
44 return 0;
45 } 1006--------------------------------------------------------------------------------------------------------------------------------- 来相思树下 Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other) Total Submission(s) : 32 Accepted Submission(s) : 0 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description 一群妖王排成一排站在苦情巨树下寻找自己的转世恋人。虽然都是妖王但按照涂山的规定必须进行标号标号为1的妖王排在最后面标号为n的妖王排在最前面。每个妖王只有一个妖力值a[i]表示它们现在的地位。妖王们是讲究实力的当然不服比它妖力值低的居然可以排在前面它们现在想知道在它前面妖力值比它低而且离它最远的距离是多少 Input 输入n表示有n个妖王第二行输入n个整数表示每个妖王的妖力值a[i]n≤2∗1051≤a[i]≤109(多组输入) Output 对于每个妖王妖力值比它低而且离它最远的距离是多少如果没有输出-1 Sample Input 6
5 50 45 7 10 1 Sample Output 4 3 2 1 0 -1对于第一个数:5,比它小的数字是11距离它最远最远距离为4
对于第二个数:50,比它小的数字是45 7 10 11距离它最远距离为3
对于第三个数:45,比它小的数字是7 10 11距离它最远距离为2
对于第四个数:7,比它小的数字是10 11距离它最远距离为1
对于第五个数:10,比它小的数字是11距离它最远距离为0
对于第六个数:已经没有比它小的数字了距离为-1Author yinghualuowu 原题http://qscoj.cn/problem/17/ 思路寻找右边比其小并且最远的我们记录从右边往左边的区间最小值一个单调递减的序列即使r[i]min(a[j])ijn;我们可以二分右边的那个区间如果右区间的r[i]当前的数说明可以向右延伸 下面给出AC代码 1 #pragma comment(linker, /STACK:1024000000,1024000000)2 #includeiostream3 #includecstdio4 #includecmath5 #includestring6 #includequeue7 #includealgorithm8 #includestack9 #includecstring
10 #includevector
11 #includelist
12 #includeset
13 #includemap
14 using namespace std;
15 #define ll long long
16 #define pi (4*atan(1.0))
17 #define eps 1e-14
18 #define bug(x) coutbugxendl;
19 const int N1e510,M1e610,inf2147483647;
20 const ll INF1e1810,mod2147493647;
21 int a[N];
22 int r[N];
23 int main()
24 {
25 int n;
26 while(~scanf(%d,n))
27 {
28 for(int i1;in;i)
29 scanf(%d,a[i]);
30 r[n]a[n];
31 for(int in-1;i1;i--)
32 r[i]min(r[i1],a[i]);
33 for(int i1;in;i)
34 {
35 int sti1;
36 int enn,ans-1;
37 while(sten)
38 {
39 int mid(sten)1;
40 if(a[i]r[mid])
41 {
42 stmid1;
43 ansmid;
44 }
45 else
46 enmid-1;
47 }
48 if(ans-1)
49 printf(-1);
50 else
51 printf(%d,ans-i-1);
52 printf(%c,((in)?\n: ));
53 }
54 }
55 return 0;
56 } 实在不会还有这种的利用CSTL 下面给出AC代码 1 #include cstdio2 #include cstring3 #include vector4 #include algorithm5 #define MAX 2000026 using namespace std;7 8 int a[MAX],ans[MAX];9 vectorint v,num;
10 #define freout freopen(out.txt,w,stdout)
11 #define frein freopen(in.txt,r,stdin)
12 int main()
13 {
14
15 int n;
16 while(~scanf(%d,n)){
17 for(int i0;in;i) scanf(%d,a[i]);
18 v.clear();
19 num.clear();
20 for(int in-1;i0;i--){
21 if(v.size()0 || v.back()a[i]){
22 v.push_back(a[i]); num.push_back(i);
23 ans[i]-1;
24 }else{
25 int j (lower_bound(v.rbegin(),v.rend(),a[i]) - v.rbegin());
26 // printf(%d %d\n,a[i],j);
27 j (int)v.size() - j ;
28 //printf(%d %d\n,num[j1],j);
29 ans[i] num[j] - i - 1;
30 }
31 }
32 for(int i0;in;i){
33 if(i) printf( );
34 printf(%d,ans[i]);
35 }
36 printf(\n);
37 }
38 return 0;
39 } 转载于:https://www.cnblogs.com/ECJTUACM-873284962/p/6506948.html