fork download
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int fak(int n){
  5. return n?n*fak(n-1):1;
  6. }
  7.  
  8. int main(){
  9. for(int i=1,res=1;res=fak(i);++i){
  10. std::cout<<i<<":"<<fak(res)<<endl;
  11. }
  12. }
Time limit exceeded #stdin #stdout 5s 3456KB
stdin
Standard input is empty
stdout
1:1
2:2
3:720
4:-775946240
5:0
6:0
7:0
8:0
9:0
10:0
11:0
12:0
13:0
14:0
15:0