
ACM
文章平均质量分 65
ACM省赛
皮得一1
这个作者很懒,什么都没留下…
展开
-
zoj 3861 Valid Pattern Lock
题意:手机图案解锁,给定n个数字,求可以得到的图案有多少种。其中有一些数字需要借助别的数字才能到达。#include#include#include#includeusing namespace std;int vis[300],a[11],mp[11][11];int ans[400000][11],f[11];int n,len;void init(){ mp[1][原创 2016-05-03 20:27:43 · 395 阅读 · 0 评论 -
zoj 3860 Find the Spy
题意:找出不同的数字。#include#include #includeusing namespace std;int main(){ int T,n,i,a[105]; scanf("%d",&T); while(T--) { scanf("%d",&n); for(i=0; i<n; i++) {原创 2016-05-03 18:01:16 · 376 阅读 · 0 评论 -
hdu 4706 Children's Day
题意:宽度从3到10输出N形状的图形。#include#includeusing namespace std;char str[16][16];int t;void display(int n){ int i,j; for(i=0;i<16;++i){ for(j=0;j<16;++j){ str[i][j]=' ';原创 2016-05-02 22:24:06 · 394 阅读 · 0 评论 -
2013山东省第三届ACM省赛 The Best Seat in ACM Contest
题意:计算每个座位的value值,根据坐在该座位的队伍长度与其上下左右方向的四个队伍长度比较。若该位置的队伍长度比一个方向的长度大,则权值减去长度差的绝对值;反之则加长度差的绝对值。#include#include#includeusing namespace std;int dir[4][2]={{-1,0},{1,0},{0,-1},{0,1}};int main(){原创 2016-05-02 22:10:50 · 424 阅读 · 0 评论 -
2013山东省第三届ACM省赛 n a^o7 !
题意:字符串转换后倒序输出。#include #include #include using namespace std; char arr[310]; int main() { char s[105]; int i,j,t; arr[ int('n') ]='u'; arr[ int('5') ]='s';原创 2016-05-02 21:30:54 · 775 阅读 · 0 评论 -
2013山东省第三届ACM省赛 Mine Number
Mine NumberTime Limit: 1000MS Memory limit: 65536K题目描述Every one once played the game called Mine Sweeping, here I change the rule. You are given an n*m map, every element is a '*' repres原创 2016-05-02 17:32:33 · 543 阅读 · 0 评论 -
zoj 3866 Cylinder Candy
Cylinder CandyTime Limit: 2 Seconds Memory Limit: 65536 KB Special JudgeEdward the confectioner is making a new batch of chocolate covered candy. Each candy center is shaped as a c原创 2016-05-02 12:52:32 · 440 阅读 · 0 评论 -
hdu 4715 Difference Between Primes
http://acm.hdu.edu.cn/showproblem.php?pid=4715#include#include#include #include #include #include using namespace std;#define N 1000000bool isprm[N];long long xx[N];void isprime(){ i原创 2016-05-01 17:32:52 · 451 阅读 · 0 评论 -
hdu 4709 Herding
http://acm.hdu.edu.cn/showproblem.php?pid=4709思路:海伦公式不可以,精度不够。#include#include#includeusing namespace std;double X[128];double Y[128];double ff(int i,int j,int k){ return fabs(X[i]*Y[原创 2016-05-01 17:30:28 · 398 阅读 · 0 评论 -
hdu 4707 Pet
http://acm.hdu.edu.cn/showproblem.php?pid=4707#include#include#include#includeusing namespace std;#define MAXN 200005int sum;int D;int dis[MAXN];bool vis[MAXN];struct Edge{ int to原创 2016-05-01 17:28:45 · 394 阅读 · 0 评论 -
hdu 4706 Children's Day
http://acm.hdu.edu.cn/showproblem.php?pid=4706#include#includeusing namespace std;char str[16][16];int t;void display(int n){ int i,j; for(i=0;i<16;++i){ for(j=0;j<16;++j){原创 2016-05-01 17:26:55 · 297 阅读 · 0 评论 -
hdu 4708 Rotation Lock Puzzle
Rotation Lock PuzzleTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u DescriptionAlice was felling into a cave. She found a strange door with a number square原创 2016-05-01 17:20:50 · 422 阅读 · 0 评论 -
2013山东省第三届ACM省赛 Pick apples
Pick applesTime Limit: 1000MS Memory limit: 165536K题目描述Once ago, there is a mystery yard which only produces three kinds of apples. The number of each kind is infinite. A girl carrying a原创 2016-04-30 18:49:30 · 534 阅读 · 0 评论 -
2013山东省第三届ACM省赛 Pixel density
Pixel densityTime Limit: 1000MS Memory limit: 65536K题目描述 Pixels per inch (PPI) or pixel density is a measurement of the resolution of devices in various contexts; typically computer di原创 2016-04-30 18:08:44 · 445 阅读 · 0 评论 -
2013山东省第三届ACM省赛 Fruit Ninja II
Fruit Ninja IITime Limit: 5000ms Memory limit: 65536K 有疑问?点这里^_^题目描述 Have you ever played a popular game named "Fruit Ninja"?Fruit Ninja (known as Fruit Ninja HD on the iPad原创 2016-04-29 16:00:01 · 419 阅读 · 0 评论 -
琪露诺的算术教室
琪露诺的算术教室Time Limit: 1000msMemory Limit: 65536KBDescription给出一个非负整数A,将这个数字的最低位移动到最高位(原来的最高位变为次高位,次低位变成最低位),得到非负整数B,发现B恰好是A的k倍。现给出A的最低位的值n,和倍数k,求最小的非负整数B。Input第一行输入一个正整数T原创 2016-04-17 19:32:03 · 1386 阅读 · 0 评论 -
2013山东省第四届ACM省赛 The number of steps
题意:一个三角形的结构,第一行有一个,第二行有二个……,你处于第一行,需要达到最后一行的第一个,最左边的只能向左下和右下走,其他的可以向左、向左下和向右下走,求达到目的地的长度的期望。思路:对于数学期望的定义是这样的。数学期望E(X) = X1*p(X1) + X2*p(X2) + …… + Xn*p(Xn)比如打靶打中8环的概率为0.3 ,打中7环的概率为0.7,那原创 2016-04-15 20:22:18 · 389 阅读 · 0 评论 -
2013山东省第四届ACM省赛 Mountain Subsequences
题意:给长度为N的字符串,只存在小写字母。问你山形的子序列有多少种,这里是子序列不是子串。所谓的山形就是严格的递增到递减。思路:从左到右求每一个位置递增子序列的个数,然后再从右向左求每一个位置递增子序列的个数,然后对应位置相乘就可以得到最终结果。#include #include #include #include using namespace std;int n;const原创 2016-04-14 22:31:13 · 384 阅读 · 0 评论 -
2013山东省第四届ACM省赛 Alice and Bob
题意: 有一个式子(a0*x^(2^0)+1) * (a1 * x^(2^1)+1)*.......*(an-1 * x^(2^(n-1))+1),给定一个P,求x^P的系数。思路:根据推导得出:例如 x^3 3的二进制表示为11,则x^3的系数为a[0]*a[1] x^4 4的二进制表示为100,则x^4的系数为a[2]对于本题输入n个a原创 2016-04-13 20:43:54 · 433 阅读 · 0 评论 -
2013山东省第四届ACM省赛 Contest Print Server
题意:TeamA request B pages。按照这个形式输入第A个队伍需要打印B张纸。然后定义s=(s*x+y)%mod。当打印的纸张数>=s时,便会重新打印这个队伍的纸张。按照要求输出。#include #include using namespace std;struct p{ int num; char name[25];} a[1005];int原创 2016-04-10 12:14:45 · 431 阅读 · 0 评论 -
2013山东省第四届ACM省赛 Rescue The Princess
题意:已知一个等边三角形的两个顶点a(x1,y1)和b(x2,y2),求第三个顶点,按照逆时针顺序求。思路:向量的旋转。参考博客:http://www.cnblogs.com/E-star/archive/2013/06/11/3131563.html#include #include #include using namespace std;int main(){原创 2016-04-10 10:29:36 · 351 阅读 · 0 评论 -
2015山东省第六届ACM省赛 Single Round Math
题意:n,m个男女,凑成n对couple,最后分成11个组,检测能否分成。思路:java大数。n==m才可以成couple,最后mod 11。import java.math.BigInteger;import java.util.Scanner;public class Main {//类名要用Main public static void main(String[] ar原创 2016-04-06 21:34:17 · 594 阅读 · 0 评论 -
2015山东省第六届ACM省赛 Game!
思路:当石子个数大于2时,后手赢。#include#includeusing namespace std;int main(){ int T; long long N; scanf("%d",&T); while(T--){ scanf("%lld",&N); if(N>2){ print原创 2016-04-06 21:15:24 · 806 阅读 · 0 评论 -
2015山东省第六届ACM省赛 Lowest Unique Price
题意:查找只被竞价一次的价格中的最小值。set用法:http://www.cnblogs.com/BeyondAnyTime/archive/2012/08/13/2636375.html#include #include #include #include #include using namespace std;int main(){ set myset;原创 2016-04-06 21:01:47 · 532 阅读 · 0 评论 -
2014山东省第五届ACM省赛 Devour Magic
题意:n个单位,每个单位每秒增加1法力,在某些时间取走一些区间的法力值(取走之后该区间所有单位的法力变为0),求取得的所有法力值。思路:线段树区间更新,求和。区间求和之后要把该区间清零。set+add操作,set在先,add在后。#include#include#includeusing namespace std;#define L(root) ((root)<<1)#def原创 2016-04-06 19:57:34 · 511 阅读 · 0 评论 -
2014山东省第五届ACM省赛 Circle
题意:n个数围成一个圈,编号0~n-1,从一个数到其上一个和下一个的数的概率相同(即都是0.5)。给出n,求从0出发到达一个数x所需要的步数的数学期望。思路:这里用递推可以水一下。首先可以确定三个结论d[i]=0.5*d[i+1]+0.5*d[i-1]d[n]=d[0]=0d[i]=d[n-i]规律:d[0]=0,d[1]=n-1,d[2]=(n-1)+(n-3),d[原创 2016-03-30 21:21:32 · 811 阅读 · 0 评论 -
2014山东省第五届ACM省赛 Hearthstone II
Hearthstone II Time Limit: 2000MS Memory limit: 65536K 题目描述The new season has begun, you have n competitions and m well prepared decks during the new season. Each competition you could原创 2016-03-28 18:01:24 · 725 阅读 · 0 评论 -
2014山东省第五届ACM省赛 Full Binary Tree
Full Binary TreeTime Limit: 2000MS Memory limit: 65536K题目描述In computer science, a binary tree is a tree data structure in which each node has at most two children. Consider an infinite原创 2016-03-28 17:58:38 · 590 阅读 · 0 评论 -
2014山东省第五届ACM省赛 Factorial
FactorialTime Limit: 2000ms Memory limit: 65536K 有疑问?点这里^_^题目描述Homelesser hates mathematics. He cannot even do addition and subtraction, not to mention computing factorial. He asks原创 2016-03-28 17:54:38 · 410 阅读 · 0 评论 -
2014山东省第五届ACM省赛 angry_birds_again_and_again
angry_birds_again_and_againTime Limit: 2000MS Memory limit: 65536K题目描述The problems called "Angry Birds" and "Angry Birds Again and Again" has been solved by many teams in the series of原创 2016-03-28 17:50:40 · 603 阅读 · 0 评论 -
2014山东省第五届ACM省赛 Weighted Median
Weighted MedianTime Limit: 2000ms Memory limit: 65536K 有疑问?点这里^_^题目描述For n elements x1, x2, ..., xn with positive integer weights w1, w2, ..., wn. The weighted median is the element x原创 2016-03-28 17:45:39 · 672 阅读 · 0 评论 -
求割点
http://www.cnblogs.com/en-heng/p/4002658.html原创 2016-02-03 16:38:39 · 389 阅读 · 0 评论 -
匈牙利算法
http://blog.youkuaiyun.com/dark_scope/article/details/8880547原创 2016-01-27 19:04:10 · 331 阅读 · 0 评论 -
山东省ACM省赛历届试题
http://acm.sdut.edu.cn/sdutoj/contest_show.php?contest_id=1254http://acm.sdut.edu.cn/sdutoj/contest_show.php?contest_id=1255http://acm.sdut.edu.cn/sdutoj/contest_show.php?contest_id=1256http://a原创 2016-01-15 10:10:37 · 3128 阅读 · 0 评论