herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
教育部為提昇全民資安素養與電腦防護能力,本部於101年9月5日至11月5日舉辦「全民資安素養自我評量」活動,請在活動期間內踴躍上網檢測資訊安全素養認知程度,並有機會參與抽獎,詳情請參閱活動網站(網址: https://isafe.moe.edu.tw/event
-
先說明一下這是後知後覺的解答,所謂後知就是股票價格已知存在陣列(清單),當然就要用迴圈練習,雙迴圈暴力解需時O(n**2),當然不用,採python單一迴圈解答「最佳股票的買賣時機#LeetCode 121 Best Time to Buy and Sell Stock」,解...
-
url="https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json&date=20220330&stockNo=2330"
-
你會用C的算子sizeof?
-
Python CPP heap priority queue速解L eetcode 2530. Maximal Score After Applying K Operations heap/priority queue是重要的資料結構,無論是C++的std::priority_q...
-
C++ DP動態規劃解Leetcode 937 Maximum Number of Points with Cost 有些標示medium要比標示hard的問題還要難,Leetcode 1937. Maximum Number of Points with Cost,DP動態規...
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);
}
}
張貼留言