编程语言
首页 > 编程语言> > 牛客编程题(二)

牛客编程题(二)

作者:互联网

//https://www.nowcoder.com/practice/a95744270f274a14a8a0dafe10421589?tpId=107&&tqId=33337&rp=1&ru=/ta/beginner-programmers&qru=/ta/beginner-programmers/question-ranking

public class Main9 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while(scanner.hasNext()) {
			int xx = scanner.nextInt();
			for(int i=0;i<xx;i++) {
				System.out.print("*");
			}
			System.out.println();
		}
	}

}

//https://www.nowcoder.com/practice/1304bb23c2e344989d5c7a578d263e4c?tpId=107&tqId=33337&rp=1&ru=%2Fta%2Fbeginner-programmers&qru=%2Fta%2Fbeginner-programmers%2Fquestion-ranking

import java.util.Scanner;

public class Main0 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			int xx = sc.nextInt();
			for (int i = 0; i < xx; i++) {
				for (int j = 0; j < xx; j++) {
					System.out.print("*");
				}
				System.out.println();
			}
		}
	}

}

//https://www.nowcoder.com/practice/00dd93f7c7074754b7511bf56d1f15ac?tpId=107&tqId=33337&rp=1&ru=%2Fta%2Fbeginner-programmers&qru=%2Fta%2Fbeginner-programmers%2Fquestion-ranking

import java.util.Scanner;

public class Main1 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int x = sc.nextInt();
			for(int i = 0;i<x;i++) {
				for(int j=0;j<=i;j++) {
					System.out.print("*"+" ");
				}
				System.out.println();
			}
		}
	}

}

//https://www.nowcoder.com/practice/2cdea429fa414fbba26e6c821724ca06?tpId=107&tqId=33337&rp=1&ru=%2Fta%2Fbeginner-programmers&qru=%2Fta%2Fbeginner-programmers%2Fquestion-ranking

public class Main3 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int x = sc.nextInt();
			for(int i=x;i>0;i--) {
				for(int j=i;j>0;j--) {
					System.out.print("*"+" ");
				}
				System.out.println();
			}
		}
	}

}

//https://www.nowcoder.com/practice/bcaf710fb58a44e1b678a890e6e90d7c?tpId=107&&tqId=33301&rp=1&ru=/ta/beginner-programmers&qru=/ta/beginner-programmers/question-ranking

import java.util.Scanner;

public class Main6 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int sum = a+b;
			int x1 = sum%10;
			int x2 = (sum/10)%10;
			System.out.println(10*x2+x1);
		}
	}

}

//https://www.nowcoder.com/practice/ffa94d27c6534396aef38813535c279f?tpId=107&tqId=33301&rp=1&ru=%2Fta%2Fbeginner-programmers&qru=%2Fta%2Fbeginner-programmers%2Fquestion-ranking
15.

import java.util.Scanner;

public class Main7 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			double x = sc.nextDouble();
			int xx = (int)x%10;
			System.out.println(xx);
		}
	}

}

//https://www.nowcoder.com/practice/4e089ee8966a4ed4b306f64e68d45264?tpId=107&&tqId=33309&rp=1&ru=/ta/beginner-programmers&qru=/ta/beginner-programmers/question-ranking
16.

import java.util.Scanner;

public class Main8 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			
			String str = sc.next();
			char x1 = str.charAt(0);
			int x = (int)x1;
			if(x<97) {
				System.out.println(str.toLowerCase());
			}
			else {
				System.out.println(str.toUpperCase());
			}
			
			
		}
	
		
	}

}

//https://www.nowcoder.com/practice/93f4d05a02d9468db424ed4316bfc8fd?tpId=107&&tqId=33297&rp=1&ru=/ta/beginner-programmers&qru=/ta/beginner-programmers/question-ranking

import java.util.Scanner;

public class Main9 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			String str = sc.next();
			char c = str.charAt(0);
			int num = (int)c;
			System.out.println(num);
		}
	}

}

//https://www.nowcoder.com/practice/c7721f3a1b1a47a783974453e82cadbb?tpId=107&&tqId=33311&rp=1&ru=/ta/beginner-programmers&qru=/ta/beginner-programmers/question-ranking

import java.util.Scanner;

public class Main0 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int n = sc.nextInt();
			int h = sc.nextInt();
			int m =  sc.nextInt();
			int res = 0;
			if(m%h==0) {
				res = n-(m/h);
			}
			else
				res = n-(m/h)-1;
			System.out.println(res);
		}
				
	}

}

标签:Scanner,int,编程,System,牛客,programmers,sc,public
来源: https://blog.csdn.net/qq_45874107/article/details/112930538