//#include <bits/stdc++.h>
#include "cielib.h"
//using namespace std;
bool amks(int a, int b){
if (a > b) return a-b > 3;
else return b- a > 3;
}
int main() {
int d = podajD();
int t[501] = {0};
int r = podajR();
czyCieplo(0);
for(int i = 0; i < d; ++i){
int last = 0, next = r, najblizszy = 0;
while (amks(last, next)){
t[i] = next;
if (czyCieplo(t))
najblizszy = t[i];
next = (najblizszy + last)/2;
last = t[i];
}
if ( najblizszy < next){
do
t[i] = ++najblizszy;
while (czyCieplo(t));
t[i]--;
}
else {
do
t[i] = --najblizszy;
while (czyCieplo(t));
t[i]++;
}
}
znalazlem(t);
}
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 | //#include <bits/stdc++.h> #include "cielib.h" //using namespace std; bool amks(int a, int b){ if (a > b) return a-b > 3; else return b- a > 3; } int main() { int d = podajD(); int t[501] = {0}; int r = podajR(); czyCieplo(0); for(int i = 0; i < d; ++i){ int last = 0, next = r, najblizszy = 0; while (amks(last, next)){ t[i] = next; if (czyCieplo(t)) najblizszy = t[i]; next = (najblizszy + last)/2; last = t[i]; } if ( najblizszy < next){ do t[i] = ++najblizszy; while (czyCieplo(t)); t[i]--; } else { do t[i] = --najblizszy; while (czyCieplo(t)); t[i]++; } } znalazlem(t); } |
English