随笔分类 - Algorithm
摘要:codeforces 670A. Holidays 题目链接: http://codeforces.com/contest/670/problem/A 题意: A. Holidays On the planet Mars a year lasts exactly n days (there are
阅读全文
摘要:1.猜灯谜 题目: A村的元宵节灯会上有一迷题: 请猜谜 * 请猜谜 = 请边赏灯边猜 小明想,一定是每个汉字代表一个数字,不同的汉字代表不同的数字。 请你用计算机按小明的思路算一下,然后提交“请猜谜”三个字所代表的整数即可。 请严格按照格式,通过浏览器提交答案。 注意:只提交一个3位的整数,不要写
阅读全文
摘要:Problem A 题目链接: http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=690&pid=1001 http://acm.hdu.edu.cn/showproblem.php?pid=5685 题目分析: 因为是
阅读全文
摘要:题目链接:https://www.patest.cn/contests/pat-b-practise/1055 分析:思路很巧妙,感觉很有意义的字符串题目
阅读全文
摘要:地址链接:http://acm.hdu.edu.cn/showproblem.php?pid=1070 题意:多看几遍,学着静下来心去看英文题 代码:
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1084 题意:根据做题数目和时间输出分数 代码:
阅读全文
摘要:题目链接:https://www.patest.cn/contests/pat-b-practise/1039 解题思路:自己刚开始想的是用两个字符串来做,搜别人题解的时候发现别人一种很好的解题思路,是用string做的,感觉做的很巧妙 具体的代码如下: 最后的代码输出用下面的代码输出答案就是报只是
阅读全文
摘要:题目链接:https://www.patest.cn/contests/pat-b-practise/1002 关键说明:
阅读全文
摘要:题目链接:http://codeforces.com/problemset/problem/659/C 题意: n是已经有的数字,m是可用的最大数字和 要求选自己没有的数字,且这些数字的数字和不能超过m 且要求可选的数字的数目越多越好 输出一种答案即可 解题思路: 刚开始想开一个bool型的1e9的
阅读全文
摘要:题目链接:http://codeforces.com/problemset/problem/659/B 题意: n个人,m个区。给出n个人的姓名(保证不相同),属于的区域,所得分数。从每个区域中选出成绩最好的两个人去参加比赛,输出这两个人的名字。如果第三个人的成绩和第二个人的成绩相同,则输出“?”,
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1075 题目大意:给出一个“翻译-原文”的对应表,然后给出句子,要把句子中的原文都翻译出来 代码:
阅读全文
摘要:#include #include #include #include #include using namespace std; int main() { int t,n; cin>>t; while(t--) { double sum=1; cin>>n; for(int i=1;i<=n;i++) ...
阅读全文
摘要:#include #include int main() { char st[1005]; int r,len; while(scanf("%s",st)&&st[0]!='0'){ r=0; len=strlen(st); for(int i=0;i<len;i++) ...
阅读全文
摘要:///hdu 1028 母函数 一个数有几种相加方式 #include #include #include #include #define INF 1000000009 using namespace std; const int _max = 10001; int c1[_max], c2[_max]; int main() { int n,i,j,k; while(c...
阅读全文
摘要:#include #include int flag,n,m; int a[1002],sum,vis[1002]; void dfs(int k) { if(flag==1) return; if(k==n+1) { sum++; if(sum==m) { flag=1; ...
阅读全文
摘要://#include #include #include #include using namespace std; int a[10000][1000]; #define MOD 100000000 int main() { int n; a[1][0]=1; a[2][0]=1; for(int i=3;i>n) { int i;...
阅读全文
摘要:#include using namespace std; int pre[2000]; int find1(int x) { int r=x; while(pre[r]!=r) { r=pre[r]; } return r; } void join(int x,int y) { int fx=find1(x); i...
阅读全文