#include "cielib.h"
using namespace std;
int mapa[1000], rotation[1000], temp[1000];
bool kappa, bolek, bol;
int main()
{
int wym=podajD();
int ruc=podajK();
int roz=podajR();
czyCieplo(mapa);
int pocz=0;
int kon=roz;
int sr=kon+1;
int zm;
sr/=2;
for(int i=0; i<wym; i++)
{
temp[i]=sr;
mapa[i]=sr;
}
while(kappa==0)
{
for(int i=0; i<wym; i++)
{
temp[i]=mapa[i];
rotation[i]=0;
}
sr++;
sr/=2;
for(int i=0; i<wym; i++)
mapa[i]+=sr;
zm=czyCieplo(mapa);
if(zm==1)
bolek=1;
else
{
czyCieplo(temp);
while(kappa==0)
{
bol=0;
for(int i=0; i<wym; i++)
{
if(rotation[i]==0)
{
rotation[i]=1;
mapa[i]-=sr*2;
bol=1;
break;
}
else
{
rotation[i]=0;
mapa[i]+=sr*2;
}
}
zm=czyCieplo(mapa);
if(zm==1)
break;
else
czyCieplo(temp);
if(bol==0)
{
for(int i=0; i<wym; i++)
mapa[i]=temp[i];
break;
}
}
}
if(sr==1)
znalazlem(mapa);
}
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #include "cielib.h" using namespace std; int mapa[1000], rotation[1000], temp[1000]; bool kappa, bolek, bol; int main() { int wym=podajD(); int ruc=podajK(); int roz=podajR(); czyCieplo(mapa); int pocz=0; int kon=roz; int sr=kon+1; int zm; sr/=2; for(int i=0; i<wym; i++) { temp[i]=sr; mapa[i]=sr; } while(kappa==0) { for(int i=0; i<wym; i++) { temp[i]=mapa[i]; rotation[i]=0; } sr++; sr/=2; for(int i=0; i<wym; i++) mapa[i]+=sr; zm=czyCieplo(mapa); if(zm==1) bolek=1; else { czyCieplo(temp); while(kappa==0) { bol=0; for(int i=0; i<wym; i++) { if(rotation[i]==0) { rotation[i]=1; mapa[i]-=sr*2; bol=1; break; } else { rotation[i]=0; mapa[i]+=sr*2; } } zm=czyCieplo(mapa); if(zm==1) break; else czyCieplo(temp); if(bol==0) { for(int i=0; i<wym; i++) mapa[i]=temp[i]; break; } } } if(sr==1) znalazlem(mapa); } } |
English