九度
zz91
浙大cs硕士在读
展开
-
九度题目1179:阶乘
http://ac.jobdu.com/problem.php?pid=11792000年华中科技大学计算机研究生机试真题不涉及大数,所以简单阶乘就好,结果保存在long long 型数据#include #include #include #include using namespace std;long long JIEC(long long x){ if原创 2013-03-08 14:30:44 · 540 阅读 · 0 评论 -
题目1496:数列区间
http://ac.jobdu.com/problem.php?pid=1496超时原因: 正常模拟,极端情况下,第k+1次操作对第k次操作的数字实现了全覆盖,则第k次操作对于最终结果全无意义改善:逆向操作,先进行第k次操作,则第k-1次操作时,为0的数字(后续操作没有再覆盖操作)才进行修改 某大牛使用了next数组,每次修改数字后原创 2013-03-17 16:07:51 · 885 阅读 · 0 评论 -
题目1493:公约数
http://ac.jobdu.com/problem.php?pid=1493思路: 1、求最大公约数,gcd 2、最大公约数,因式分解,(循环除小于bound的素数) 3、k1个因子1,k2个因子2,k3个因子3... 4、ans=(k1+1)(k2+1)(k3+1)....#include #include #inc原创 2013-03-17 14:57:37 · 607 阅读 · 0 评论 -
九度题目1099:后缀子串排序
http://ac.jobdu.com/problem.php?pid=10992010年上海交通大学计算机研究生机试真题1、每轮测试都要清空容器2、substr的使用#include #include #include #include using namespace std;vector ans;int main(){ string s,tmp;原创 2013-03-10 17:52:51 · 512 阅读 · 0 评论 -
九度&1195:最长&最短文本
http://ac.jobdu.com/problem.php?pid=1195#include #include #include #include using namespace std;struct E { char a[1005]; int len;}buf[1000];int main(){// freopen("D:\\1.txt","r原创 2013-03-08 14:19:05 · 813 阅读 · 0 评论 -
题目1174:查找第K小数
http://ac.jobdu.com/problem.php?pid=11742010年北京邮电大学网院研究生机试真题#include #include #include using namespace std;int a[1005];int main(){ int n,i,k; while (scanf("%d",&n)!=EOF) { for (i=0;i<原创 2013-03-08 23:14:53 · 501 阅读 · 0 评论 -
九度题目1175:打牌
http://ac.jobdu.com/problem.php?pid=11752010年北京邮电大学网院研究生机试真题#include #include char a[105],b[105];int count[10]; //统计a中出现牌的个数,1几张,2几张int main(){//freopen("D:\\1.txt","r",stdin); i原创 2013-03-08 23:07:56 · 704 阅读 · 0 评论 -
题目1203:IP地址
http://ac.jobdu.com/problem.php?pid=12032006年华中科技大学计算机保研机试真题全部判断完毕再输出#include #include int main(){ freopen("D:\\1.txt","r",stdin); int x,n,i; char ch; while (scanf("%d",&n)!=EOF) { wh原创 2013-03-08 16:59:45 · 641 阅读 · 0 评论 -
九度题目1182:统计单词
http://ac.jobdu.com/problem.php?pid=11822002年华中科技大学计算机研究生机试真题将输入一行字符串转为单个输入单词,每次输出个数,若最后一个字符是.则结束本行输入熟悉双重while循环的输入方式#include #include char str[1000];int main(){freopen("D:\\1.txt","r",原创 2013-03-08 15:40:09 · 510 阅读 · 0 评论 -
九度题目1184:二叉树遍历
http://ac.jobdu.com/problem.php?pid=11842002年华中科技大学计算机研究生机试真题ABC##DE#G##F###先序建树:a ,左孩子b。 b,左孩子c, c,左孩子空,右孩子空,退回b b,右孩子d原创 2013-03-08 15:22:58 · 942 阅读 · 0 评论 -
九度&题目1180:对称矩阵
http://ac.jobdu.com/problem.php?pid=11802000年华中科技大学计算机研究生机试真题#include #include #include #include using namespace std;int a[105][105];int main(){freopen("D:\\1.txt","r",stdin); int n原创 2013-03-08 14:39:41 · 633 阅读 · 0 评论 -
题目1165:字符串匹配
http://ac.jobdu.com/problem.php?pid=11652008年北京航空航天大学计算机研究生机试真题#include #include #include #include using namespace std;string a[1005],A[1005]; //a保存输入的字符串,A保存转换为大写后的字符串string tmp,pre原创 2013-03-09 10:41:39 · 728 阅读 · 0 评论 -
题目1167:数组排序
http://ac.jobdu.com/problem.php?pid=11672009年北京航空航天大学计算机研究生机试真题#include #include #include using namespace std;struct E { int no; int data; int order;}buf[10005];bool cmp1(E A,E B){原创 2013-03-09 12:58:59 · 648 阅读 · 0 评论 -
hdu1575:Tr A_矩阵的幂&二分求幂
http://acm.hdu.edu.cn/showproblem.php?pid=1575二维矩阵做参数,写在结构体里,优化;#include #include struct Matrix { int m[12][12];}a,b,c;int n,m,i,j,k;Matrix deal(Matrix a,Matrix b) //基本的矩阵乘法原创 2013-03-08 22:13:29 · 551 阅读 · 0 评论 -
题目1199:找位置
http://ac.jobdu.com/problem.php?pid=11992005年华中科技大学计算机保研机试真题1、注意一些细节,逗号的处理;换行的处理;第一次检测到与之后检测到相同字符的不同处理2、#include #include int main(){ //freopen("D:\\1.txt","r",stdin); int i,j; char s原创 2013-03-08 16:39:52 · 628 阅读 · 0 评论 -
题目1466:排列与二进制
http://ac.jobdu.com/problem.php?pid=1466思路:例:(10,5) 10*9*8*7*6=30240,其二进制,末尾5个0,正好等于,10,9,8,7,6的二进制末尾 0的个数的和。10的二进制,1010,1个0;8,1000,3个0...优化:1、j%2==0 可以变为:( j&1 )==0原创 2013-03-17 20:59:14 · 763 阅读 · 0 评论