Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- using namespace std;
- int _fastcall f(int x) {
- int flag, tmp;
- _asm {
- pushad
- mov flag, 0
- cmp ecx, 0
- jle _end
- mov eax, ecx
- imul eax, ecx
- mov ebx, 10
- _loop:
- cdq
- idiv ebx
- push eax
- push edx
- mov eax, ecx
- cdq
- idiv ebx
- pop tmp
- mov ecx, eax
- pop eax
- cmp edx, tmp
- jne _end
- cmp ecx, 0
- jne _loop
- mov flag, 1
- _end:
- popad
- mov eax, flag
- }
- }
- /*
- int main() {
- ifstream fin("input.txt");
- int a[111][111], n, ok[111];
- unsigned char m;
- fin >> n;
- for (int i = 0; i < n; ++i)
- for (int j = 0; j < n; ++j) fin >> a[i][j];
- m = n;
- _asm {
- pushad
- xor ecx, ecx
- mov cl, m
- lea esi, a
- mov n, 0
- xor ebx, ebx
- _loop1:
- push esi
- push ecx
- mov edx, 1
- mov cl, m
- _loop2:
- push ecx
- mov ecx, [esi]
- call f
- and edx, eax
- pop ecx
- add esi, 444
- loop _loop2
- pop ecx
- pop esi
- cmp edx, 0
- je _null
- mov eax, n
- mov ok[ebx * 4], eax
- inc ebx
- _null:
- add esi, 4
- inc n
- loop _loop1
- mov n, ebx
- popad
- }
- for (int i = 0; i < n; ++i) cout << ok[i] << " ";
- cout << endl;
- }*/
- int main() {
- ifstream fin("input.txt");
- int **a, n, ok[111], i, n4;
- unsigned char m;
- fin >> n;
- a = new int * [n];
- for (int i = 0; i < n; ++i) {
- a[i] = new int [n];
- for (int j = 0; j < n; ++j) fin >> a[i][j];
- }
- m = n;
- _asm {
- pushad
- xor ecx, ecx
- mov cl, m
- mov n, 0
- mov n4, 0
- xor ebx, ebx
- _loop1:
- push ecx
- mov edx, 1
- mov cl, m
- mov i, 0
- _loop2:
- mov esi, a
- add esi, i
- mov esi, [esi]
- add esi, n4
- push ecx
- mov ecx, [esi]
- call f
- and edx, eax
- pop ecx
- add i, 4
- loop _loop2
- pop ecx
- cmp edx, 0
- je _null
- mov eax, n
- mov ok[ebx * 4], eax
- inc ebx
- _null:
- inc n
- add n4, 4
- loop _loop1
- mov n, ebx
- popad
- }
- for (int i = 0; i < n; ++i) cout << ok[i] << " ";
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement