Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <numeric>
- #include <ctime>
- using namespace std;
- void init(int* a, int val) {
- int i = 5;
- while (i > -1) {
- a[i] = val % 10;
- val /= 10;
- --i;
- }
- }
- int check(int* a) {
- return a[0]+a[1]+a[2] == 10 && a[3]+a[4]+a[5] == 10;
- }
- int main() {
- int* a = new int[6];
- int res = 0;
- time_t t = clock();
- for (int i = 0; i < 10e6; ++i) {
- init(a, i);
- res += check(a);
- }
- printf("time: %f\nres: %d", (clock() - t) / CLOCKS_PER_SEC, res);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement