[ create a new paste ] login | about

Link: http://codepad.org/cltqwP9j    [ raw code | output | fork ]

C++, pasted on Feb 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <cstdio>
//B1026. 程序运行时间
//B1028.人口普查
#include <math.h>
int main() {
	int A, B, D;
	int a = 0;
	//scanf("%d%d%d", &A, &B, &D);
        A = 123;
B = 456;
D = 8;
	int ans;
	ans = A + B;
	for(int i = 0; i < ans; i++) {
		a = a*10 + ans % D;
		ans = ans / D;
		if(ans == 0) break;
	}
	printf("%d", a);
	return 0;
}


Output:
1
301


Create a new paste based on this one


Comments: