当前位置:网站首页>OJ daily practice - spanning 2020

OJ daily practice - spanning 2020

2022-06-22 23:34:00 KJ. JK

Problem description :

Find three positive integers satisfying the following equations a, b, c:

 Insert picture description here

Input
nothing

Output
a、b、c, Space apart .


Input
nothing

Output
Does not provide


Java Code :

public class Main{
    
	public static void main(String[] args) {
    
		int a=1;
		int b=1;
		int c=1;
		boolean jk=true;
		while(jk) {
    
			a++;
			for(int i=0;i<2021;i++) {
    
				for(int j=0;j<2021;j++) {
    
					if(a*i+j==2020&&i*j+a==2021) {
    
						jk=false;
						System.out.println(a);
						System.out.println(i);
						System.out.println(j);
					}
				}
			}
		}
	}
}

author :KJ.JK
If the article is helpful to you , Welcome to praise or star, Your support is the greatest encouragement to the author , The shortcomings can be corrected in the comments section , Communication and learning

原网站

版权声明
本文为[KJ. JK]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206222059454504.html