herrDeng網內搜尋

自訂搜尋
Ads
2011年6月9日 星期四
訂閱:
張貼留言 (Atom)
熱門文章
-
請用CPU-Z軟體檢測Cache & Memory 註:快取(L1-L3: SRAM) 第一級快取(L1)–通常存取只需要幾個週期,通常是幾十個KB。 第二級快取(L2)–比L1約有2到10倍較高延遲性,通常是幾百個KB或更多。 第三級快取(L3)(不...
-
計算gcd(123456789,999999999)
-
需要練習的Java程式:
-
C++ DP速解難題leetcode 3363 Find the Maximum Number of Fruits Collected [Python解請進]
-
問int怎麼存-689這個數字。 int用4個bytes。 答案請用16進位表達。
-
Leetcode 342 Power of Four幾個C++一行解 [codes on Leetcode] https://leetcode.com/problems/power-of-four/solutions/7081839/9-ways-of-bit-manipula...
26 則留言:
import java.util.*;
import java.io.*;
public class fileRead {
public static void main (String[]args) throws Exception
{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
while (input.hasNext())
{
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if (input.hasNextInt())
System.out.println();
}
}
}
import java.util.Scanner;
import java.io.*;
class GAP{
public static void main(String [] args)throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
int sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if(input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("平均"+b);
}
}
import java.util.Scanner;
import java.io.*;
class ab{
public static void main(String [] args)throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
int sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if(input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("平均"+b);
}
}
import java.util.*;
import java.io.*;
public class fileRead {
public static void main(String[] args) throws Exception
{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
float sum=0;
while (input.hasNext())
{
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if (input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
sum=sum/(i-1);
System.out.println();
System.out.print("平均= "+sum);
}
}
import java.util.Scanner;
import java.io.*;
class dd{
public static void main(String [] args)throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
float sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if(input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
sum=sum/(i-1);
System.out.println();
System.out.print("平均="+sum);
}
}
import java.util.Scanner;
import java.io.*;
class dd{
public static void main(String [] args)throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
int sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if(input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("全班平均是:"+b);
}
}
import java.util.Scanner;
import java.io.*;
class dd{
public static void main(String [] args)throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
int sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if(input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("平均"+b`);
}
}
import java.util.Scanner;
import java.io.*;
class fileRead{
public static void main(String [] args)throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
int sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if(input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("平均"+b);
}
}
import java.util.*;
import java.io.*;
class fileRead {
public static void main(String[] args) throws Exception
{ File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int sum=0;
int i=0;
int a;
while (input.hasNext())
{ tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if (input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum/(i-1));
System.out.print("全班平均是:"+b);
}
}
import java.util.*;
import java.io.*;
public class U1 {
public static void main(String[]args) throws Exception
{
File f=new File("test.txt");
Scanner input=new Scanner (f);
String tmp;
int i=0;
int sum=0;
int a;
while (input.hasNext())
{
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if (input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("平均是:"+b);
}
}
import java.util.Scanner;
import java.io.*;
class fileRead {
public static void main(String[] args) throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
int sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if (input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("全班平均:"+b);
}
}
import java.util.*;
import java.io.*;
public class U1 {
public static void main(String[]args) throws Exception
{
File f=new File("test.txt");
Scanner input=new Scanner (f);
String tmp;
int i=0;
int sum=0;
int a;
while (input.hasNext())
{
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if (input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("全班的平均是:"+b);
}
}
import java.util.Scanner;
import java.io.*;
class fileRead {
public static void main(String[] args) throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
int sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if (input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("全班平均:"+b);
}
}
import java.util.*;
import java.io.*;
public class U1 {
public static void main(String[]args) throws Exception
{
File f=new File("test.txt");
Scanner input=new Scanner (f);
String tmp;
int i=0;
int sum=0;
int a;
while (input.hasNext())
{
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if (input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("全班的平均是:"+b);
}
}
import java.util.Scanner;
import java.io.*;
class fileRead {
public static void main(String[] args) throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
int sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if (input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("全班平均:"+b);
}
}
import java.util.Scanner;
import java.io.*;
class fileRead {
public static void main(String[] args) throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
int sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if (input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("全班平均:"+b);
}
}
import java.util.Scanner;
import java.io.*;
class fileRead {
public static void main(String[] args) throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
int sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if (input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("全班平均:"+b);
}
}
import java.util.Scanner;
import java.io.*;
class fileRead {
public static void main(String[] args) throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
int sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if (input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("全班平均:"+b);
}
}
import java.util.Scanner;
import java.io.*;
class fileRead {
public static void main(String[] args) throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
int sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if (input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("全班平均:"+b);
}
}
import java.util.Scanner;
import java.io.*;
class fileRead {
public static void main(String[] args) throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
int sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if (input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("全班平均:"+b);
}
}
import java.util.Scanner;
import java.io.*;
class fileRead {
public static void main(String[] args) throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
int sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if (input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("全班平均:"+b);
}
}
import java.util.*;
public class Fibonacci{
public static double a(int n)
{
double sqrt5=Math.sqrt(5);
double a1=Math.pow((1+sqrt5)/2,n);
double a2=Math.pow((1-sqrt5)/2,n);
return (a1-a2)/sqrt5;
}
public static void f(int n){
int f[]=new int[n+1];
f[0]=0;f[1]=1;
for(int i=2; i<=n; i++){
f[i]=f[i-1]+f[i-2];
System.out.print("f["+i+"]="+f[i]);
System.out.println("a("+1+")="+a(i));
}
}
public static void main(String[] args)throws Exception{
Scanner input=new Scanner(System.in);
int n=input.nextInt();
f(n);
}
}
import java.util.*;
public class Fibonacci{
public static double a(int n)
{
double sqrt5=Math.sqrt(5);
double a1=Math.pow((1+sqrt5)/2,n);
double a2=Math.pow((1-sqrt5)/2,n);
return (a1-a2)/sqrt5;
}
public static void f(int n){
int f[]=new int[n+1];
f[0]=0;f[1]=1;
for(int i=2; i<=n; i++){
f[i]=f[i-1]+f[i-2];
System.out.print("f["+i+"]="+f[i]);
System.out.println("a("+1+")="+a(i));
}
}
public static void main(String[] args)throws Exception{
Scanner input=new Scanner(System.in);
int n=input.nextInt();
f(n);
}
}
import java.util.*;
public class Fibonacci{
public static double a(int n)
{
double sqrt5=Math.sqrt(5);
double a1=Math.pow((1+sqrt5)/2,n);
double a2=Math.pow((1-sqrt5)/2,n);
return (a1-a2)/sqrt5;
}
public static void f(int n){
int f[]=new int[n+1];
f[0]=0;f[1]=1;
for(int i=2; i<=n; i++){
f[i]=f[i-1]+f[i-2];
System.out.print("f["+i+"]="+f[i]);
System.out.println("a("+1+")="+a(i));
}
}
public static void main(String[] args)throws Exception{
Scanner input=new Scanner(System.in);
int n=input.nextInt();
f(n);
}
}
fileRead
import java.util.Scanner;
import java.io.*;
class fileRead {
public static void main(String[] args) throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
int sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if (input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("全班平均:"+b);
}
}
import java.util.Scanner;
import java.io.*;
class ab{
public static void main(String [] args)throws Exception{
File f=new File("test.txt");
Scanner input=new Scanner(f);
String tmp;
int i=0;
int a;
int sum=0;
while (input.hasNext()){
tmp=input.next();
System.out.print(i++);
System.out.print("\t"+tmp);
if(input.hasNextInt())
{
a=input.nextInt();
System.out.print("\t"+a);
sum+=a;
}
System.out.println();
}
float b=((float)sum)/(i-1);
System.out.print("平均"+b);
}
}
張貼留言