Skip to content

Commit 8c0e6d4

Browse files
committed
add 3 new hdu file
1 parent 28281bb commit 8c0e6d4

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed

HDU/hdu_1128.cpp

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* time: 2013-12-18 19:51
3+
* author: AmazingCaddy
4+
* solve: make a answer table
5+
*/
6+
#include <iostream>
7+
#include <cstdio>
8+
#include <algorithm>
9+
#include <cmath>
10+
#include <cstdlib>
11+
using namespace std;
12+
13+
const int maxn = 1000000 + 200;
14+
15+
int vis[maxn];
16+
17+
int get_solve(int n) {
18+
int sum = n;
19+
while (n) {
20+
sum += n % 10;
21+
n /= 10;
22+
}
23+
return sum;
24+
}
25+
26+
void init() {
27+
memset(vis, 0, sizeof(vis));
28+
for (int i = 0; i <= 1000000; i ++) {
29+
vis[get_solve(i)] = 1;
30+
}
31+
}
32+
33+
int main (int argc, char *argv[]) {
34+
init();
35+
for (int i = 0; i <= 1000000; i ++) {
36+
if (!vis[i]) {
37+
printf ("%d\n", i);
38+
}
39+
}
40+
return 0;
41+
}

HDU/hdu_1215.cpp

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* time: 2013-12-18 20:10
3+
* author: AmazingCaddy
4+
* solve: make a answer table
5+
*/
6+
#include <iostream>
7+
#include <cstdio>
8+
#include <algorithm>
9+
#include <cmath>
10+
#include <cstdlib>
11+
using namespace std;
12+
13+
const int maxn = 500000 + 200;
14+
15+
int dp[maxn];
16+
17+
void fac(int n) {
18+
memset( dp, 0, sizeof( dp ) );
19+
for( int i = 1; i < n; ++i ) {
20+
for( int j = i; j < n; j += i ) {
21+
dp[ j ] += i;
22+
}
23+
}
24+
}
25+
26+
int main (int argc, char *argv[]) {
27+
int cas, n;
28+
fac(maxn);
29+
scanf ("%d", &cas);
30+
for (int t = 1; t <= cas; t ++){
31+
scanf ("%d", &n);
32+
printf("%d\n", dp[n] - n);
33+
}
34+
return 0;
35+
}

HDU/hdu_2104.cpp

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* time: 2013-12-18 20:44
3+
* author: AmazingCaddy
4+
* solve: gcd
5+
*/
6+
#include <iostream>
7+
#include <cstdio>
8+
#include <algorithm>
9+
#include <cmath>
10+
#include <cstdlib>
11+
using namespace std;
12+
13+
int gcd(int a, int b) {
14+
return b ? gcd(b, a % b) : a;
15+
}
16+
17+
int main (int argc, char *argv[]) {
18+
int n, m;
19+
while (scanf ("%d%d", &n, &m) && n != -1 && m != -1) {
20+
if (gcd(n, m) == 1) {
21+
printf ("YES\n");
22+
} else {
23+
printf ("POOR Haha\n");
24+
}
25+
}
26+
return 0;
27+
}

0 commit comments

Comments
 (0)