well, guys. This is one of the greatest lols I ever met.
count=input()
for i in xrange(count):
next=input()
j=1; q=1
while j<next:
j+=1; q=q*j
print q,'asdfgh'
Now I put values in one by one and pressing [Enter]:
3
5
120 asdfgh
6
720 asdfgh
7
5040 asdfgh
33
33
"For" cycle is executed only 3 times and that's ok. But why Py shell
then waits for one more input value (33) and then echoes it without
asking and only after that it terminates the code execution...
it's above my head (maybe irreversibly damaged by VB).
Właśnie męczę się z tym zadaniem, ale cały czas mam TLE.
Czy mógłby ktoś mi powiedzieć co w moim rozwiązaniu jest nie tak?
#include<stdio.h>
#include<list>
#include<queue>
#include<stack>
#define MAXN 1002
using namespace std;
class Graf{
private:
int n,nrGrafu;
bool odwiedzony[MAXN];
list<int> graf[MAXN];
queue<int> kol;
void DFS(int start);
void BFS(int start);
public:
Graf(int nr);
void obsluz();
};
Graf::Graf(int nr){
nrGrafu=nr;
scanf("%d", &n);
for(int i=1; i<=n; i++){
int m,o,t;
scanf("%d %d",&o,&m);
for(int j=0;j<m;j++)
{
scanf("%d",&t);
graf[o].push_back(t);
};
};
};
void Graf::obsluz(){
printf("graph %d\n", nrGrafu);
while(1){
int typ, sta;
scanf("%d %d",&sta, &typ);
if( sta == 0) break;
for(int i=0; i<=n; i++) odwiedzony[i]=false;
if (typ==0) DFS(sta);
if (typ==1) BFS(sta);
printf("\n");
};
};
void Graf::DFS(int i)
{
odwiedzony[i]=true;
printf("%d ",i);
for(list<int>::iterator k=graf[i].begin(); k!=graf[i].end();k++)
if(odwiedzony[*k]==false) DFS(*k);
};
void Graf::BFS(int start){
kol.push(start);
bool odwiedzony[n+1];
for(int i=0; i<=n; i++) odwiedzony[i]=false;
odwiedzony[start]=true;
while(!kol.empty()){
printf("%d ", kol.front());
list<int>::iterator i;
for(i=graf[kol.front()].begin(); i != graf[kol.front()].end(); ++i){
if(!odwiedzony[*i]) kol.push(*i);
odwiedzony[*i]=true; };
kol.pop();
};
};
int main(){
int d;
scanf("%d", &d);
for(int nrGr=1;nrGr<=d;nrGr++){
Graf grafik(nrGr);
grafik.obsluz();
};
return 0;
};
Cześć. Ponieważ mam pytanie nt. tego samego zadania to podepnę się do tego wątku. Otóż, kiedy próbowałem wysłać rozwiązanie ( pl.spoj.pl/submit/ROWNANIE/) otrzymałem informację:
Wystąpił błąd
Wrong problem!
Czy chodzi o to, że nie można już wysyłać rozwiązań? Nie mogę znaleźć nic na ten temat w FAQ więc liczę, że ktoś po prostu spotkał się z taką sytuacją.