2013
12-26

# 母牛的故事

n=0表示输入数据的结束，不做处理。

n=0表示输入数据的结束，不做处理。

2
4
5
0

2
4
6

f[i] = f[i-1] + f[i-3], i > 4

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.*;
import java.io.*;
import java.math.*;

public class Main {
public static void main(String []args){
Scanner cin = new Scanner(System.in);
Integer N = 55,i,n;
BigInteger[] fm = new BigInteger[N],fx = new BigInteger[N];
for(i = 1; i < 5; ++i)
fm[i] = BigInteger.valueOf(i);
for(; i < N; ++i)

while(true){
n = cin.nextInt();
if(n == 0)
break;
System.out.println(fm[n]);
}
}
}

1. #include <stdio.h>
int main()
{
int n,p,t[100]={1};
for(int i=1;i<100;i++)
t =i;
while(scanf("%d",&n)&&n!=0){
if(n==1)
printf("Printing order for 1 pages:nSheet 1, front: Blank, 1n");
else {
if(n%4) p=n/4+1;
else p=n/4;
int q=4*p;
printf("Printing order for %d pages:n",n);
for(int i=0;i<p;i++){
printf("Sheet %d, front: ",i+1);
if(q>n) {printf("Blank, %dn",t[2*i+1]);}
else {printf("%d, %dn",q,t[2*i+1]);}
q–;//打印表前
printf("Sheet %d, back : ",i+1);
if(q>n) {printf("%d, Blankn",t[2*i+2]);}
else {printf("%d, %dn",t[2*i+2],q);}
q–;//打印表后
}
}
}
return 0;
}