20 раз:
7, 17, 27, 37, 47, 57, 67, 87, 97
70, 71, 72, 73, 74, 75, 76, 77, 78, 79
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c,d1,d2,d=0,n=0;
srand (time(NULL));
a = rand() % 50 + 1;
b = rand() % 50 + 1;
c = rand() % 20 + 1;
while (c>a) a = rand() % 50 + 1;
while (c>b) b = rand() % 50 + 1;
printf ("%d %d %d\n", a, b, c);
d1 = a; d2 = b;
while (d1>=c){
d2 = b;
while (d2>=c){ n++; d2 -= c; }
d1 -= c;
}
printf("%d\n", n);
for (int i=0; i<(10-1); i++) d += n;
d = -d;
printf("%d", d);
return 0;
}
Пример:
<span>27 42 4
60
-540</span>
64 = 1000000
-120 = -1111000
-96 = -1100000
57 = 111001
Вот конвертер: http://whoyougle.ru/measure/hex/
#include < iostream>
using namespace std;
int main()
{
int n, f;
f = 1;
cin >> n;
for(int i = 1; i <= n; ++i){
f *= i;
}
cout << f;
return 0;
}
1000 = 2^3*1 + 2^2*0 + 2^1*0 + 2^0*0 = 8 + 0 + 0 + 0 = 8
0001 = 2^3*0 + 2^2*0 + 2^1*0 + 2^0*1 = 0 + 0 + 0 + 1 = 1
0110 = 2^3*0 + 2^2*1 + 2^1*1 + 2^0*0 = 0 + 4 + 2 + 0 = 6
0001 = 2^3*0 + 2^2*0 + 2^1*0 + 2^0*1 = 0 + 0 + 0 + 1 = 1
0101 = 2^3*0 + 2^2*1 + 2^1*0 + 2^0<span>*1 = 0 + 4 + 0 + 1 = 5
</span>0100 = 2^3*0 + 2^2*1 + 2^1*0 + 2^0<span>*0 = 0 + 4 + 0 + 0 = 4
</span>1001 = 2^3*1 + 2^2*0 + 2^1*0 + 2^0*1 = 8 + 0 + 0 + 1 = 9
Если это одно большое число, то вот так
1000000101100001010101001001 = 2^27*1 + 2^26*0 + 2^25*0 + 2^24*0 + 2^23*0 + 2^22*0 + 2^21*0 + 2^20*1 + 2^19*0 + 2^18*1 + 2^17*1 + 2^16*0 + 2^15*0 + 2^14*0 + 2^13*0 + 2^12*1 + 2^11*0 + 2^10*1 + 2^9*0 + 2^8*1 + 2^7*0 + 2^6*1 + 2^5*0 + 2^4*0 + 2^3*1 + 2^2*0 + 2^1*0 + 20*1 = 134217728 + 0 + 0 + 0 + 0 + 0 + 0 + 1048576 + 0 + 262144 + 131072 + 0 + 0 + 0 + 0 + 4096 + 0 + 1024 + 0 + 256 + 0 + 64 + 0 + 0 + 8 + 0 + 0 + 1 = 135664969
<u />
^ - Возведение в степень