- 博客(5)
- 收藏
- 关注
原创 0-1背包
/*The first line contain a integer T , the number of cases. Followed by T cases , each case three lines , the first line contain two integer N , V, (N <= 1000 , V <= 1000 )representing the number of
2017-07-18 16:26:55 130
原创 pat 乙级 数素数
题目地址 https://www.patest.cn/contests/pat-b-practise/1013 说明两点 第一, 鉴于输出格式,对最后一个数单独处理 第二,此法过于暴力 /*令Pi表示第i个素数。现任给两个正整数M <= N <= 104,请输出PM到PN的所有素数。 输入格式: 输入在一行中给出M和N,其间以空格分隔。 输出格式: 输出从PM到PN的所有
2017-04-23 17:32:01 234
原创 pat 乙级数学黑洞
题目地址 https://www.patest.cn/contests/pat-b-practise/1019 /* 给定任一个各位数字不完全相同的4位正整数,如果我们先把4个数字按非递增排序,再按非递减排序,然后用第1个数字减第2个数字,将得到一个新的数字。一直重复这样做,我们很快会停在有“数字黑洞”之称的6174,这个神奇的数字也叫Kaprekar常数。 例如,我
2017-04-23 16:50:57 284
原创 螺旋矩阵输出
题目地址 https://www.patest.cn/contests/pat-b-practise/1050 #include #include #include using namespace std; int a[10000], b[10000][10000] = { 0 }; /* 12 37 76 20 98 76 42 53 95 60 81
2017-04-19 18:45:30 409
原创 pat 乙级 打印沙漏
题目 地址 https://www.patest.cn/contests/pat-b-practise/1027 #include using namespace std; int main(){ int n, rea, c; char p; cin >> n; cin >> p; int j, i; for(i = 1; i { if( 2
2017-04-17 15:32:17 200
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人