data.cpp
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
void data(){
int x,y;
x=rand()%100;
y=rand()%1000+1;
printf("%d %d\n",x,y);
}
void name(int k){
char str[111];
sprintf(str,"%d",k);
strcat(str,".in");
freopen(str,"w",stdout);
}
int main(){
srand(time(NULL));
for(int k=1;k<=10;k++){
name(k);
data();
}
}
go.cpp
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
double calculate(double x,double n)
{
if(n==1)
return x/(1+x);
else
return x/(n+calculate(x,n-1));
}
int main()
{
freopen("1.in","r",stdin);
freopen("1.out","w",stdout);
double n,x;
double result;
cin>>x>>n;
result=calculate(x,n);
printf("%.2lf\n",result);
return 0;
}