HDU 1017 直接暴力。】的更多相关文章

C - 3 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1017 Description Given two integers n and m, count the number of pairs of integers (a,b) such that 0 < a < b < n and (a^2+b^2 +m)/(a…
A Mathematical Curiosity Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 41995    Accepted Submission(s): 13502 Problem Description Given two integers n and m, count the number of pairs of integ…
题目简单,格式酸爽.. #include <iostream> using namespace std; int ans,n,m,p; int main() { cin>>p; while(p--) { ; while(~scanf("%d%d",&n,&m)&&(n+m)) { ans=; ;i<n;i++) { ;j<n;j++) { ) ans++; } } printf("Case %d: %d\n&…
题目链接 Problem Description Given two integers n and m, count the number of pairs of integers (a,b) such that 0 < a < b < n and (a^2+b^2 +m)/(ab) is an integer. This problem contains multiple test cases! The first line of a multiple input is an inte…
题意是给定 n,m,问有多少组(a,b)满足 0 < a < b < n 而且 (a ^ 2 + b ^ 2 + m) / ( a * b ) 是整数. 直接模拟即可. 代码如下: #include <bits/stdc++.h> using namespace std; int main() { int t,ans,n,m; bool f = false; scanf("%d",&t); while(t--) { if(f) printf(&qu…
解题报告:输入两个数,n和m,求两个数a和b满足0<a<b<n,并且(a^2+b^2+m) % (a*b) =0,这样的a和b一共有多少对.注意这里的b<n,并不可以等于n. 简单的数学题,要注意的就是格式,这题TM描述的真烂,注意每组测试数据之后有一个空行,但最后一组测试数据之后没有空行. #include<cstdio> int main() { int T,n,m; scanf("%d",&T); while(T--) { ; whil…
A Mathematical Curiosity Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 25871    Accepted Submission(s): 8174 Problem Description Given two integers n and m, count the number of pairs of integ…
#include<stdio.h> int main() { int N; int n,m; int a,b; int cas; scanf("%d",&N); while(N--) { cas=1;//必须在这儿初始化cas,坑 while(scanf("%d%d",&n,&m),n||m) { int count=0; for(a = 1; a < n; a++)//穷举法 { for(b = a + 1; b <…
Problem Description Given two integers n and m, count the number of pairs of integers (a,b) such that 0 < a < b < n and (a^2+b^2 +m)/(ab) is an integer. This problem contains multiple test cases! The first line of a multiple input is an integer N…
//2014.10.17    01:19 //题意: //先输入一个数N,然后分块输入,每块输入每次2个数,n,m,直到n,m同一时候为零时  //结束,当a和b满足题目要求时那么这对a和b就是一组 //注意: //每一块的输出中间有一个回车 A Mathematical Curiosity Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s…
首先是几份模版 KMP void kmp_pre(char x[],int m,int fail[]) { int i,j; j = fail[] = -; i = ; while (i < m) { && x[i] != x[j]) j = fail[j]; fail[++i] = ++j; } } int kmp_count(char x[],int m,char y[],int n) { ,j = ; ; while (i < n) { && y[i] !…
ORZ,这道题想复杂了,原来直接暴力就能够了复杂度为 n * n * logn #include<cstdio> #include<set> #include<algorithm> using namespace std; typedef long long LL; const int maxn = 10005; set<LL>s; set<LL>::iterator it1,it2; int n,m; int num[maxn] = {0};…
题目:pid=1017">点击打开链接 #include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { int a=0; int m,n; while(scanf("%d%d",&n,&m)) { if(m==0&&n==0) break; a++; int i,j,k,z=0; for(i=1;i<n;i++) for(j…
King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember history, King plans to play losephus problem in the parade gap.He calls n(1≤n≤5000) soldiers, counterclockwise in a circle, in label 1,2,3...n. The firs…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1017 A Mathematical Curiosity Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 47658    Accepted Submission(s): 15285 Problem Description Given two…
树链剖分是一个很固定的套路 一般用来解决树上两点之间的路径更改与查询 思想是将一棵树分成不想交的几条链 并且由于dfs的顺序性 给每条链上的点或边标的号必定是连着的 那么每两个点之间的路径都可以拆成几条链 那么就是对一群区间进行更改 这时候基本是用线段树进行logn的操作 做了三道基础题 都属于比较好想的 也就是线段树比较麻烦 需要写相当长一段时间... HDU 3966 给出一棵树的连接状况和边的大小 每次可以对a-b的路径的边的权值取反 或者改变指定边的值 或者求a-b路径的最大值 每次取反…
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 1049 1050 1057 1062 1063 1064 1070 1073 1075 1082 1083 1084 1088 1106 1107 1113 1117 1119 1128 1129 1144 1148 1157 1161 1170 1172 1177 1197 1200 1201…
题目链接:hdu 2177 这题不是普通的 Nim 博弈,我想它应该是另一种博弈吧,于是便推 sg 函数打了个 20*20 的表来看,为了方便看一些,我用颜色作了标记,打表代码如下: #include<cstdio> #include<cstring> #include<string> #include<map> #include<algorithm> #include<windows.h> using namespace std;…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5113 题目大意:有k种颜色的方块,每种颜色有ai个, 现在有n*m的矩阵, 问这k种颜色的方块能否使任意两个相连的方块颜色不一样填满整个矩阵,如果可以输出任意一种. 解题思路:由于n,m在[1, 5]内, 所以直接暴力枚举: 需要注意的是:需要剪枝一下. 代码如下: #include<stdio.h> #include<string.h> #include<cmath> #…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5113 Black And White Time Limit: 2000/2000 MS (Java/Others)Memory Limit: 512000/512000 K (Java/Others) 问题描述 In mathematics, the four color theorem, or the four color map theorem, states that, given any…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4864 解题报告:有n台机器用来完成m个任务,每个任务有一个难度值和一个需要完成的时间,每台机器有一个可以工作的最长时间和一个可以完成的任务的难度的最大值, 一台机器能完成一个任务的条件是这台机器的最长工作时间和能完成任务的难度值必须都大于等于这个任务,而且一台机器最多完成一个任务,假设一个任务的时间为t,难度值为x,那么完成这个任务可以赚到的钱 money = 500 * t + 2 * x; 现在…
http://acm.hdu.edu.cn/showproblem.php?pid=5968 题意:中文题意. 思路:一开始不会做,后来发现数据范围很小,而且那个数要是连续的,所以可能把所有情况枚举出来很小吧.打了个表发现 100 只有 4950 个,然后直接暴力枚举每一种情况,放在Hash里面标记是否出现过这个数,再弄一个len数组放置每一种情况长度,然后对答案分别向左和向右找最长的长度就好了. #include <cstdio> #include <cstring> #incl…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5280 Senior's Array Description One day, Xuejiejie gets an array $A$. Among all non-empty intervals of $A$, she wants to find the most beautiful one. She defines the beauty as the sum of the interval. Th…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4150 Powerful Incantation Description Some dangerous Witches invaded the garden city! As a righteous magician, james0zan want to find the most powerful incantation so he can beat those dangerous witches…
Kingdom of Black and White Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5583 Description In the Kingdom of Black and White (KBW), there are two kinds of frogs: black frog and white frog. Now N frogs are stand…
转自——http://blog.csdn.net/qwe20060514/article/details/8112550 =============================以下是最小生成树+并查集======================================[HDU]1213   How Many Tables   基础并查集★1272   小希的迷宫   基础并查集★1325&&poj1308  Is It A Tree?   基础并查集★1856   More i…
Teacher Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5762 Description Teacher BoBo is a geography teacher in the school.One day in his class,he marked N points in the map,the i-th point is at (Xi,Yi).He wonders,whether there is a tetrad (A,B,C,…
sequence2 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5568 Description Given an integer array bi with a length of n, please tell me how many exactly different increasing subsequences. P.S. A subsequence bai(…
Partial Tree Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5534 Description In mathematics, and more specifically in graph theory, a tree is an undirected graph in which any two nodes are connected by exactly…
L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5538 Description Have you ever played the video game Minecraft? This game has been one of the world's most popular game in recent years. The wor…