[Logo] Mendo Judge Discussion Board - Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
Messages posted by: BATIR
Forum Index » Profile for BATIR » Messages posted by BATIR
Author Message
Ќе ја разгледам задачава, и ќе видам во најбрзо време ако можам некако да ти помогнам.
Може линк?
Мислам дека има повеќе линкови за консултација за оваа задача но сепак ако сега ти користи еве го кодот.
Пробај да го разбереш пред да го пратиш
Каде ја најде задачата?
Mozes da obasnis kodo vo najbrzo vreme
?
Treba da koristam pomal kod so bfs
greska
Greska
Не го знам текстот од задачата, а според ова што ти го напиша можеш да напишеш код со if(),тоа би изгледало вака:
#include <iostream>

using namespace std;

int main()
{
int n;
cin>>n;
if(n>=6 && n<=14)
{
cout<<"osnovno"<<endl;
}
else if (n>=15&&n<=1
{
cout<<"sredno"<<endl;
}
else if(n>=19&& n<=22)
{
cout<<"fakultet"<<endl;
}
else if (n>=23 && n<=64)
{
cout<<"vraboten"<<endl;
}else if (n>64)
{
cout<<"penzioner"<<endl;
}
else if(n<6)
{
cout<<"gradinka"<<endl;
}
else
{
cout<<"-1"<<endl;
}
return 0;
}

Доколку овај код не работи, пиши ми пак.
pardon greska jas ti prtiv dr resenie eve go pravoto

#include <iostream>
#include <cstring>
#include <queue>
using namespace std;

int main()
{
int x, y;
int ex, ey;
cin >> x >> y;
cin >> ex >> ey;
if( x + y != ex + ey)
{
cout << -1 << endl;
return 0;
}
int zbir = x + y;
bool vis[200001];
memset(vis, 0, sizeof(vis));
queue <int> q, cekori;
q.push(x);
cekori.push(0);

while(!q.empty())
{
int temeX = q.front();
int cek = cekori.front();
q.pop();
cekori.pop();
if( temeX == ex )
{
cout << cek << endl;
break;
}
int temeY = zbir - temeX;
if( temeY - 1 > 0 && vis[temeX + 1] == false)
{
vis[temeX + 1] = true;
q.push(temeX + 1);
cekori.push(cek + 1);
}
if (temeX-1-((2*temeX)%31) > 0 && vis[temeX-1-((2*temeX)%31)]==false)
{
vis[temeX-1-((2*temeX)%31)] = true;
q.push(temeX-1-((2*temeX)%31));
cekori.push(cek + 1);
}
}
return 0;
}
ako go imas resenieto od sponzori prati mi go se macam
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;

int main(){
int x[500];
int i=0;
int dolzina=0;
while(true){
cin >> x[i];
dolzina++;
if(x[i]==3)
break;
i++;
}
i=0;
int columns=0;
while(x[i]!=2){
columns++;
i++;
}
columns-=1;
int row = dolzina/columns;
cout << row << " " << columns;
}
Прво пробај да ја сватиш задачата , а потоа види го решениево кое поминува на сите тест случаи.

#include <iostream>
#include <cstring>
#include <queue>
#include <vector>
using namespace std;

int main()
{
int teminja, kosta, kiril, parichki;
cin >> teminja >> kosta >> kiril >> parichki;
int cnt = 0;
bool vis[100001];
memset(vis, false, sizeof(vis));
queue<int> q;
for(int i=0; i<kosta; i++)
{
int a;
cin>> a;
vis[a]=true;
q.push(a);
}
for(int i=0; i<kiril; i++)
{
int a;
cin >> a;
vis[a] = true;
}
int rebra;
cin >> rebra;
vector <int> niza[100001];
for(int i=0; i<rebra; i++)
{
int a, b;
cin >> a >> b;
niza[a].push_back(b);
niza[b].push_back(a);
}

while(!q.empty())
{
int teme = q.front();
q.pop();
for(int i=0; i<niza[teme].size(); i++)
{
int novo = niza[teme][i];
if(vis[novo] == false)
{
vis[novo] = true;
q.push(novo);
cnt++;
}
}
}

if(cnt > parichki)
cnt = parichki;
cout << cnt << endl;
return 0;
}
грешка
kako ja resavate zadaca slika . dokolku imate odgovor pisete mi PP, ili tuka.

fala odnapred
fala mnogu lekov ne ssi ja primetiv taa greska, fala odnapred
 
Forum Index » Profile for BATIR » Messages posted by BATIR
Go to:   
Powered by JForum 2.1.8 © JForum Team