herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
計算你的BMI
-
1. 利用遞迴input n算2^n 2. 用C算GCD(3333,456)
-
請用 C/C++/java寫一簡易程式
-
33, 45, 87, 99, 27 算平均
-
BMI (Body Mass Index)= 體重 (kg) / 身高 ^2(m 2 ) 在台灣,行政院衛生署乃根據其相關研究,於2002年4月公佈台灣成人肥胖標準: BMI<18.5 為過輕, 18.5≦BMI<24 為正常體重, 24≦BMI<27 為過重, BM...
-
一、 試利用switch case由程式中直接輸入一個1~7 之間的整數day,代表星期一到星期日。若day 的值是1,則印出 "星期一",若day 的值是2,則印出 "星期二",若day 的值是7,則印出 "星期日",...
-
需要練習的Java程式:
-
用 C/C++算上學期加權平均
66 則留言:
public class b9733054 {
/**
* @param args
*/
static int gcd(int x,int y){
int r=x%y;
if(r==0)return y;
else
return gcd(y,r);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
int x=123456789;
int y=999999999;
System.out.println(gcd(x,y));
}
}
class Program
{
static int gcd (int a, int b)
{
int r = a % b;
if (r == 0) return b;
else
return gcd(b, r);
}
static void Main(string[] args)
{
int r;
int x = 123456789,y=999999999;
{
Console.Write("GCD:");
Console.WriteLine(gcd(x, y));
Console.ReadLine();
}
}
}
}
package pack1;
public class a1 {
public static void main(String[] args) {
int x, y;
System.out.print("最大公因函數為:");
x = 123456789;
y = 999999999;
System.out.println(gcd(x, y));
}
static int gcd(int a, int b)
{
int c = a % b;
if(c == 0)
return b;
else
return gcd(b, c);
}
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int m,n,temp=0,tm,tn;
Scanner choose=new Scanner(System.in);
m=choose.nextInt();
n=choose.nextInt();
tm=m;
tn=n;
while(n!=0){
temp=n;
n=m%n;
m=temp;
}
System.out.println("("+tm+","+tn+")="+m);
}
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int m,n,temp=0,tm,tn;
Scanner choose=new Scanner(System.in);
m=choose.nextInt();
n=choose.nextInt();
tm=m;
tn=n;
while(n!=0){
temp=n;
n=m%n;
m=temp;
}
System.out.println("("+tm+","+tn+")="+m);
}
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int m,n,temp=0,tm,tn;
Scanner choose=new Scanner(System.in);
m=choose.nextInt();
n=choose.nextInt();
tm=m;
tn=n;
while(n!=0){
temp=n;
n=m%n;
m=temp;
}
System.out.println("("+tm+","+tn+")="+m);
}
}
public class B1 {
static int gcd(int x,int y)
{
int r=x%y;
if (r==0)return y;
else return gcd(y,r);
}
public static void main(String[] args){
System.out.println(gcd(123456789,999999999));
}
}
package P1;
public class B9933052A {
static int gcd(int x , int y)
{
int r =x%y;
if(r==0) return y;
else
return gcd(y,r);
}
public static void main(String[] args) {
System.out.println(gcd(123456789 , 999999999));
}
}
static int gcd (int x,int y)
{
int r = x % y;
if (r == 0) return y;
else
return gcd (y, r);
}
static void Main(string[] args)
{
int x = 123456789, y = 999999999;
{
Console.Write("GCD:");
Console.WriteLine(gcd(x, y));
Console.ReadLine();
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int m,n,temp=0,tm,tn;
Scanner choose=new Scanner(System.in);
m=choose.nextInt();
n=choose.nextInt();
tm=m;
tn=n;
while(n!=0){
temp=n;
n=m%n;
m=temp;
}
System.out.println("("+tm+","+tn+")="+m);
}
}
static int gcd(int a, int b)
{
int r = a % b;
if (r == 0) return b;
else
return gcd(b, r);
}
static void Main(string[] args)
{
int x = 123456789,y=999999999;
{
Console.Write("GCD:");
Console.WriteLine(gcd(x, y));
Console.ReadLine();
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EX3
{
class Program
{
static int gcd(int x, int y)
{
int r = x % y;
if (r == 0) return y;
else
return gcd(y, r);
}
static void Main(string[] args)
{
int x = 123456789, y = 999999999;
{
Console.Write("GCD:");
Console.WriteLine(gcd(x, y));
Console.ReadLine();
}
}
}
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int m,n,temp=0,tm,tn;
Scanner choose=new Scanner(System.in);
m=choose.nextInt();
n=choose.nextInt();
tm=m;
tn=n;
while(n!=0){
temp=n;
n=m%n;
m=temp;
}
System.out.println("("+tm+","+tn+")="+m);
}
}
class Program
{
static int gcd(int x, int y)
{
int r = x % y;
if (r == 0) return y;
else
return gcd(y, r);
}
static void Main(string[] args)
{
int x = 123456789, y = 999999999;
{
Console.Write("GCD:");
Console.WriteLine(gcd(x, y));
Console.ReadLine();
}
}
}
}
public class b99330114 {
static int gcd(int x,int y)
{
int r=x%y;
if(r==0)return y;
else return gcd(y,r);
}
public static void main(String[] args) {
System.out.println(gcd(123456789,999999999));
}
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int x,y,temp=0,tx,ty;
x=123456789;
y=999999999;
tx=x;
ty=y;
while(y!=0){
temp=y;
y=x%y;
x=temp;
}
System.out.println("("+tx+","+ty+")="+x);
}
}
public class GCD
{
static int gcd(int x,int y)
{
int tmp;
while (x % y != 0)
{
tmp = y;
y = x % y;
x = tmp;
}
return y;
}
public static void main(String[] args)
{
System.out.println(gcd(123456789,999999999));
}
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int m,n,temp=0,tm,tn;
Scanner choose=new Scanner(System.in);
m=choose.nextInt();
n=choose.nextInt();
tm=m;
tn=n;
while(n!=0){
temp=n;
n=m%n;
m=temp;
}
System.out.println("("+tm+","+tn+")="+m);
}
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int x,y,temp=0,tx,ty;
x=123456789;
y=999999999;
tx=x;
ty=y;
while(y!=0){
temp=y;
y=x%y;
x=temp;
}
System.out.println("("+tx+","+ty+")="+x);
}
}
package P1;
public class B1 {
static int gcd(int x,int y)
{
int r=x%y;
if(r==0)return y;
else return gcd(y,r);
}
public static void main(String[] args) {
System.out.println(gcd(123456789,999999999));
}
}
package test1;
import java.util.Scanner;
public class SS1 {
public static void main(String[] args)
{
int m,n,temp=0,tm,tn;
Scanner choose=new Scanner(System.in);
m=choose.nextInt();
n=choose.nextInt();
tm=m;
tn=n;
while(n!=0){
temp=n;
n=m%n;
m=temp;
}
System.out.println("("+tm+","+tn+")="+m);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EX3
{
class Program
{
static int gcd(int x, int y)
{
int r = x % y;
if (r == 0) return y;
else
return gcd(y, r);
}
static void Main(string[] args)
{
int x = 123456789, y = 999999999;
{
Console.Write("GCD:");
Console.WriteLine(gcd(x, y));
Console.ReadLine();
}
}
}
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int x,y,temp=0,tx,ty;
x=123456789;
y=999999999;
tx=x;
ty=y;
while(y!=0){
temp=y;
y=x%y;
x=temp;
}
System.out.println("("+tx+","+ty+")="+x);
}
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int x,y,temp=0,tx,ty;
x=123456789;
y=999999999;
tx=x;
ty=y;
while(y!=0){
temp=y;
y=x%y;
x=temp;
}
System.out.println("("+tx+","+ty+")="+x);
}
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int x,y,temp=0,tx,ty;
x=123456789;
y=999999999;
tx=x;
ty=y;
while(y!=0){
temp=y;
y=x%y;
x=temp;
}
System.out.println("("+tx+","+ty+")="+x);
}
}
class gcd {
public static int gcd(int m, int n) {
if(n != 0)
return gcd(n, m % n);
else return m;
}
public static void main(String[] args) {
System.out.println("GCD of (123456789,999999999) = " + gcd(123456789,999999999));
}
}
package pack;
public class pack {
static int gcd(int x, int y)
{
int r = x%y;
if (r==0)
return y;
else
return gcd(y,r);
}
public static void main(String[] args) {
System.out.println(gcd(123456789,999999999));
}
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int x,y,temp=0,tx,ty;
x=123456789;
y=999999999;
tx=x;
ty=y;
while(y!=0){
temp=y;
y=x%y;
x=temp;
}
System.out.println("("+tx+","+ty+")="+x);
}
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int x,y,temp=0,tx,ty;
x=123456789;
y=999999999;
tx=x;
ty=y;
while(y!=0){
temp=y;
y=x%y;
x=temp;
}
System.out.println("("+tx+","+ty+")="+x);
}
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int x,y,temp=0,tx,ty;
x=123456789;
y=999999999;
tx=x;
ty=y;
while(y!=0){
temp=y;
y=x%y;
x=temp;
}
System.out.println("("+tx+","+ty+")="+x);
}
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int x,y,temp=0,tx,ty;
x=123456789;
y=999999999;
tx=x;
ty=y;
while(y!=0){
temp=y;
y=x%y;
x=temp;
}
System.out.println("("+tx+","+ty+")="+x);
}
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int x,y,temp=0,tx,ty;
x=123456789;
y=999999999;
tx=x;
ty=y;
while(y!=0){
temp=y;
y=x%y;
x=temp;
}
System.out.println("("+tx+","+ty+")="+x);
}
}
package PP1;
public class GCD {
static int gcd(int x,int y)
{
int tmp;
while(x % y != 0)
{
tmp=y;
y= x%y;
x=tmp;
}
return y;
}
public static void main(String[] args) {
System.out.println(gcd(123456789,999999999));
}
}
package b1;
public class b1 {
public static void main(String[] args) {
int m,n,gcd=0,tm,tn;
m=123456789;
n=999999999;
tm=m;
tn=n;
while(n!=0){
gcd=n;
n=m%n;
m=gcd;
}
System.out.println("("+tm+","+tn+")="+m);
}
}
package p1;
import java.io.*;
public class A1 {
static long gcd(long x ,long y)
{
if(y==0)return x;
else
return gcd(y,x%y);
}
public static void main(String[] args) throws Exception{
long x=123456789;
long y=888888888;
long ans=gcd(x,y);
System.out.println("最大公因數"+(ans));
}
static int gcd(int x, int y)
{
int r=x % y ;
if(r==0) return y;
else
return gcd(y,r);
}
public static void main(String[] args) {
int a, b;
System.out.print("最大公因函數為:");
a=123456789;
b=999999999;
System.out.println(gcd(a,b));
}
}
package P1;
public class A {
static int gcd(int x,int y)
{
int r= x % y;
if(r==0) return y ;
else
return gcd(y,r);
}
public static void main(String[] args) {
int a , b;
System.out.print("最大公因數:");
a=123456789;
b=999999999;
System.out.println(gcd(a,b));
}
}
package P1;
import java.util.Scanner;
public class A1
{
public static void main(String[] args)
{
int m,n,temp=0,tm,tn;
Scanner choose=new Scanner(System.in);
m=123456789;
n=999999999;
tm=m;
tn=n;
while(n!=0){
temp=n;
n=m%n;
m=temp;
}
System.out.println("("+tm+","+tn+")="+m);
}
}
import java.util.Scanner;
public class b9933014 {
public static void main(String[] args) {
int x,y,temp=0,tx,ty;
x=123456789;
y=999999999;
tx=x;
ty=y;
while(y!=0){
temp=y;
y=x%y;
x=temp;
}
System.out.println("("+tx+","+ty+")="+x);
}
}
package test1;
import java.util.Scanner;
public class SS1 {
public static void main(String[] args)
{
int m,n,temp=0,tm,tn;
Scanner choose=new Scanner(System.in);
m=choose.nextInt();
n=choose.nextInt();
tm=m;
tn=n;
while(n!=0){
temp=n;
n=m%n;
m=temp;
}
System.out.println("("+tm+","+tn+")="+m);
}
}
package pack1;
public class a1 {
static int gcd(int a, int b)
{
int c = a % b;
if(c == 0)
return b;
else
return gcd(b, c);
}
public static void main(String[] args) {
int x, y;
System.out.print("最大公因函數為:");
x = 123456789;
y = 999999999;
System.out.println(gcd(x, y));
}
}
package p1;
import java.io.*;
public class C1 {
static long gcd(long x,long y)
{
if(y==0)return x;
else
return gcd (y,x%y);
}
public static void main(String[] args)throws Exception {
long x=123456789;
long y=999999999;
long ans=gcd(x,y);
System.out.println("最大公因數="+(ans));
package B1;
public class b2
{
static int gcd(int x,int y)
{
int r=x%y;
if(r==0)return y;
else
return gcd(y,r);
}
public static void main(String[] args)
{
int x=123456789;
int y=999999999;
System.out.println("gcd:"+ gcd(x,y));
}
}
package p1;
import java.io.*;
public class C1 {
static long gcd(long x,long y)
{
if(y==0)return x;
else
return gcd (y,x%y);
}
public static void main(String[] args)throws Exception {
long x=123456789;
long y=999999999;
long ans=gcd(x,y);
System.out.println("最大公因數="+(ans));
package a1;
public class a1 {
static int gcd (int a , int b)
{
int c=a % b;
if (c == 0)
return b;
else
return gcd (b,c);
}
public static void main(String[] args) {
int x,y;
System.out.print("gcd=");
x=123456789;
y=999999999;
System.out.print(gcd(x,y));
}
}
import java.util.Scanner;
public class A1 {
public static void main(String[] args) {
int x,y,temp=0,tx,ty;
x=123456789;
y=999999999;
tx=x;
ty=y;
while(y!=0){
temp=y;
y=x%y;
x=temp;
}
System.out.println("("+tx+","+ty+")="+x);
}
}
import java.util.Scanner;
public class V12313213 {
public static void main(String args[]){
int x,y,temp=0,tx,ty;
x=123456789;
y=999999999;
tx=x;
ty=y;
while(y!=0){
temp=y;
y=x%y;
x=temp;
}
System.out.println("("+tx+","+ty+")="+x);
}
}
package P1;
public class A1 {
static int gcd(int x,int y)
{
int r=x % y;
if(r==0)
return y;
else
return gcd(y,r);
}
public static void main(String[] args)
{
int x=123456789;
int y=999999999;
System.out.println("最大公因數="+gcd(x,y));
}
}
package P1;
import java.util.Scanner;
public class A1 {
public static void main(String[] args) {
int m,n,temp=0,tm,tn;
Scanner choose=new Scanner(System.in);
m=123456789;
n=999999999;
tm=m;
tn=n;
while(n!=0){
temp=n;
n=m%n;
m=temp;
}
System.out.println("("+tm+","+tn+")="+m);
}
}
package p1;
import java.io.*;
public class A1 {
static long gcd(long x ,long y)
{
if(y==0)return x;
else
return gcd(y,x%y);
}
public static void main(String[] args) throws Exception{
long x=123456789;
long y=999999999;
long ans=gcd(x,y);
System.out.println("最大公因數"+(ans));
}
}
package P1;
import java.util.Scanner;
public class A1
{
public static void main(String[] args)
{
int m,n,temp=0,tm,tn;
Scanner choose=new Scanner(System.in);
m=123456789;
n=999999999;
tm=m;
tn=n;
while(n!=0){
temp=n;
n=m%n;
m=temp;
}
System.out.println("("+tm+","+tn+")="+m);
}
package pack1;
public class A1 {
public static void main(String[] args) {
long a=123456789;
long b=999999999;
long ans=swap(a,b);
System.out.println(ans);
}
static long swap (long a,long b)
{
if(b==0)
return a;
else
return swap(b,a%b);
}
}
package P1;
import java.io.*;
public class B9933019 {
static long gcd (long x,long y)
{
if (y==0)
return x;
else return gcd (y,x%y);
}
public static void main (String[]args)
{
long x=123456789;
long y=999999999;
long s=gcd(x,y);
System.out.println("最大公因數="+(s));
}
}
public clss god
pulic static void main(Stlng[]args){
long a = 123456789
long b = 999999999
long ans=swop(a,b);
System.outy.pringln(ans);
}
static long swap (long a , long b)
{
if (b ==0)
return a;
else
return swop(b, a%b);
}
}
swapo
package B9933057;
import java.io.*;
public class B9933057 {
static long gcd (long x,long y)
{
if (y==0)
return x;
else return gcd (y,x%y);
}
public static void main (String[]args)
{
long x=123456789;
long y=999999999;
long s=gcd(x,y);
System.out.println("最大公因數="+(s));
}
}
package A1;
public class A1 {
public static void main(String[] args) {
long x=123456789;
long y=999999999;
long ans=swap(x,y);
System.out.println(ans);
}
static long swap(long a,long b)
{
if(b==0)
return a;
else
return swap(b,a%b);
}
}
package pack;
public class pack {
static int gcd(int x, int y)
{
int r = x%y;
if (r==0)
return y;
else
return gcd(y,r);
}
public static void main(String[] args) {
System.out.println(gcd(123456789,999999999));
}
}
public class B1 {
public static void main(String[] args) {
long x=123456789;
long y=999999999;
long ans=swap(x,y);
System.out.println(ans);
}
static long swap(long a,long b)
{
if(b==0)
return a;
else
return swap(b,a%b);
}
}
package pack1;
public class A3 {
public static void main(String[] args){
long a=123456789;
long b=999999999;
long ans=smap(a,b);
System.out.println(ans);
}
static long smap(long a,long b)
{
if(b==0)
return a;
else
return smap(b,a%b);
}
}
package pack1;
import java.io.*;
public class A1 {
static long gcd(long x,long y)
{
if(y==0)
return x;
else
return gcd (y,x%y);
}
public static void main(String[] args)
{
long x=123456789;
long y=999999999;
long s=gcd(x,y);
System.out.println("最大公因數="+(s));
}
}
package t1;
import java.io.*;
public class t1
{
static long gcd (long x,long y)
{
if (y==0)
return x;
else
return gcd(y,x%y);
}
public static void main(String[] args)
{
long x=123456789;
long y=999999999;
long s=gcd(x,y);
System.out.println("最大公因數="+(s));
}
}
package pack1;
public class A3 {
public static void main(String[] args){
long a=123456789;
long b =999999999;
long ans=smap(a,b);
System.out.println(ans);
}
static long smap(long a,long b)
{
if(b==0)
return a;
else
return smap(b,a% b);
}
}
package pack1;
public class A3 {
public static void main(String[] args){
long a=123456789;
long b =999999999;
long ans=smap(a,b);
System.out.println(ans);
}
static long smap(long a,long b)
{
if(b==0)
return a;
else
return smap(b,a% b);
}
}
package pack;
public class pack {
static int gcd(int x, int y)
{
int r = x%y;
if (r==0)
return y;
else
return gcd(y,r);
}
public static void main(String[] args) {
System.out.println(gcd(123456789,999999999));
}
}
public class A1
{
public static void main(String[] args)
{
long a=123456789;
long b=999999999;
long ans=swap(a,b);
System.out.println(ans);
}
static long swap(long a,long b)
{
if(b==0)
return a;
else
return swap(b,a%b);
}
}
public class B9933051
{
public static void main(String[] args)
{
long a=123456789;
long b=999999999;
long ans=swap(a,b);
System.out.println(ans);
}
static long swap(long a,long b)
{
if(b==0)
return a;
else
return swap(b,a%b);
}
}
張貼留言