
#programowanie #informatyka
http://pl.spoj.com/problems/PA05_POT/
wyskakuje mi blad "przekroczono limit czasu"
wytlumaczy ktos czemu?
#include
using namespace std;
int potega(int a,int b)
{
if(b==0) return 1;
return a*potega(a,b-1);
}
int main()
{
short t;
cin >> t;
int a;
int b;
while(t>0)
{
cin >> a >> b;
cout << potega(a,b)%10 << endl;
t--;
}
return 0;
}
http://pl.spoj.com/problems/PA05_POT/
wyskakuje mi blad "przekroczono limit czasu"
wytlumaczy ktos czemu?
#include
using namespace std;
int potega(int a,int b)
{
if(b==0) return 1;
return a*potega(a,b-1);
}
int main()
{
short t;
cin >> t;
int a;
int b;
while(t>0)
{
cin >> a >> b;
cout << potega(a,b)%10 << endl;
t--;
}
return 0;
}
- Najlepsze
- Wszystkie komentarze







Z tym że trzeba tam umieć zdawać pytania, bo inaczej mogą cię zjeść, tak samo unikać duplikatów co nie powinno być trudne, ale spokojnie, to nie elektroda, tutaj duplikat po prostu ktoś zamknie i
Komentarz usunięty przez autora