头像

Tourist_4




离线:40分钟前


最近来访(4)
用户头像
一半醒
用户头像
春天在哪李
用户头像
种花家的兔兔


Tourist_4
2小时前

AcWing《秋招每日一题(Java/C++)》拼团优惠!https://www.acwing.com/activity/content/introduction/2171/group_buy/83897/




AcWing《考研算法套餐》拼团优惠!https://www.acwing.com/activity/content/introduction/2151/group_buy/81895/



活动打卡代码 AcWing 753. 平方矩阵 I

Tourist_4
1个月前
import javax.swing.plaf.synth.SynthOptionPaneUI;
import java.util.Map;
import java.util.Scanner;

public class Main
{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            if(n==0)break;
            solve(n);
            System.out.println();
        }
    }
    public  static  void solve(int n){
        int a[][]=new int [n+1][n+1];
        for(int k=1;k<=n;k++)
        for(int i=k;i<=n-k+1;i++)
        {
            for(int j=k;j<=n-k+1;j++){
                a[i][j]=k;
            }
        }
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++) System.out.printf("%d ",a[i][j]);
            System.out.println();
        }
    }

}


活动打卡代码 AcWing 727. 菱形

Tourist_4
1个月前
import javax.swing.plaf.synth.SynthOptionPaneUI;
import java.util.Map;
import java.util.Scanner;

public class Main
{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int t=n/2;
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                if(Math.abs(i-t)+Math.abs(j-t)<=t)
                    System.out.printf("*");
                else System.out.printf(" ");
            }
            System.out.println();
        }
    }

}


活动打卡代码 AcWing 708. 偶数

Tourist_4
1个月前
import javax.swing.plaf.synth.SynthOptionPaneUI;
import java.util.Map;
import java.util.Scanner;

public class Main
{
    public static void main(String[] args) {
        for(int i=1;i<=100;i++)
        {
            if((i&1)!=1) System.out.println(i);
        }
    }

}


活动打卡代码 AcWing 670. 动物

Tourist_4
1个月前
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String a = sc.nextLine(), b = sc.nextLine(), c = sc.nextLine();

        if (a.equals("vertebrado")) 
        {
            if(b.equals("ave"))
            {
                if(c.equals("carnivoro")) System.out.println("aguia");
                else System.out.println("pomba");
            } 
            else 
            {
                if(c.equals("onivoro")) System.out.println("homem");
                else System.out.println("vaca");
            } 
        } 
        else 
        {
            if(b.equals("inseto")) 
            {
                if(c.equals("hematofago")) System.out.println("pulga");
                else System.out.println("lagarta");
            } 
            else 
            {
                if(c.equals("hematofago")) System.out.println("sanguessuga");
                else System.out.println("minhoca");
            }
        }
    }
}


活动打卡代码 AcWing 667. 游戏时间

Tourist_4
1个月前
import javax.swing.plaf.synth.SynthOptionPaneUI;
import java.util.Map;
import java.util.Scanner;

public class Main
{
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        int a= sc.nextInt();int b= sc.nextInt();
        if(a==b) System.out.println("O JOGO DUROU 24 HORA(S)");
        else{
            if(a>b)
            System.out.printf("O JOGO DUROU %d HORA(S)\n",Math.min((24-a+b),24));
            else
                System.out.printf("O JOGO DUROU %d HORA(S)\n",b-a);

        }
    }

}


活动打卡代码 AcWing 659. 区间

Tourist_4
1个月前
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        double n = sc.nextDouble();

        if (n >= 0 && n <= 25) System.out.println("Intervalo [0,25]");
        else if (n > 25 && n <= 50) System.out.println("Intervalo (25,50]");
        else if (n > 50 && n <= 75) System.out.println("Intervalo (50,75]");
        else if (n > 75 && n <= 100) System.out.println("Intervalo (75,100]");
        else System.out.println("Fora de intervalo");


    }
}




活动打卡代码 AcWing 660. 零食

Tourist_4
1个月前
import java.util.Map;
import java.util.Scanner;

public class Main
{
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        double c[]=new double[]{4,4.5,5,2,1.5};
        int a=sc.nextInt();a--;
        int b=sc.nextInt();
        System.out.printf("Total: R$ %.2f",c[a]*b);
    }

}


活动打卡代码 AcWing 665. 倍数

Tourist_4
1个月前
import java.util.Scanner;

public class Main
{
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        int a=sc.nextInt();
        int b= sc.nextInt();
        if(a%b==0||b%a==0) System.out.println("Sao Multiplos");
        else System.out.println("Nao sao Multiplos");
    }

}