头像

heng-




离线:9小时前


最近来访(128)
用户头像
大梦雨潇
用户头像
pengyany
用户头像
XZ1195160770
用户头像
砥砺
用户头像
ElevenYexi
用户头像
kelvin2009
用户头像
ruihan7
用户头像
日不落
用户头像
圆梦背影
用户头像
冰中月
用户头像
缥缈
用户头像
搁浅_1
用户头像
Error_666
用户头像
无敌大炎哥
用户头像
77an
用户头像
芝士汉堡
用户头像
lzyer
用户头像
不败的gou子
用户头像
槿城花开
用户头像
暑假学完基础课


heng-
11小时前
import java.util.*;

public class Main {
    public static void main(String ags[]) {
        Scanner cin = new Scanner(System.in);
        char c = cin.next().charAt(0);
        double mp[][] = new double[13][13];
        for (int i = 1; i <= 12; i++)
            for (int j = 1; j <= 12; j++)
                mp[i][j] = cin.nextDouble();
        double sum = 0;
        int cnt = 0;
        int l = 2, r = 11, cent = 1;
        for (int i = 1; i <= 6; i++) {
            for (int j = 1; j <= i - 1; j++) {
                cnt+=2;
                sum += mp[i][j];
                sum += mp[12 - i + 1][j];
            }
        }
        if (c == 'S')
            System.out.printf("%.1f", sum);
        else
            System.out.printf("%.1f", sum / cnt);
    }
}



heng-
11小时前
import java.util.*;

public class Main {
    public static void main(String ags[]) {
        Scanner cin = new Scanner(System.in);
        char c = cin.next().charAt(0);
        double mp[][] = new double[13][13];
        for (int i = 1; i <= 12; i++)
            for (int j = 1; j <= 12; j++)
                mp[i][j] = cin.nextDouble();
        double sum = 0;
        int cnt = 0;
        int l = 2, r = 11, cent = 1;
        while (l < r) {
            for (int i = l; i <= r; i++) {
                sum += mp[cent][i];
                cnt++;
            }
            l++;
            r--;
            cent++;
        }
        if (c == 'S')
            System.out.printf("%.1f", sum);
        else
            System.out.printf("%.1f", sum / cnt);
    }
}




heng-
11小时前
import java.util.*;

public class Main {
    public static void main(String ags[]) {
        Scanner cin = new Scanner(System.in);
        char c = cin.next().charAt(0);
        double mp[][] = new double[13][13];
        for (int i = 1; i <= 12; i++)
            for (int j = 1; j <= 12; j++)
                mp[i][j] = cin.nextDouble();
        double sum = 0;
        int cnt = 0;
        for (int i = 1; i <= 12; i++)
            for (int j = 1; j <= 12 - i; j++) {
                sum += mp[i][j];
                cnt++;
            }
        if (c == 'S')
            System.out.printf("%.1f", sum);
        else
            System.out.printf("%.1f", sum / cnt);
    }
}




heng-
11小时前
import java.util.*;

public class Main {
    public static void main(String ags[]) {
        Scanner cin = new Scanner(System.in);
        char c = cin.next().charAt(0);
        double mp[][] = new double[13][13];
        for (int i = 1; i <= 12; i++)
            for (int j = 1; j <= 12; j++)
                mp[i][j] = cin.nextDouble();
        double sum = 0;
        int cnt = 0;
        for (int i = 1; i <= 12; i++)
            for (int j = 12; j > i; j--) {
                sum += mp[i][j];
                cnt++;
            }
        if (c == 'S')
            System.out.printf("%.1f", sum);
        else
            System.out.printf("%.1f", sum / cnt);
    }
}



活动打卡代码 AcWing 743. 数组中的行

heng-
11小时前
import java.util.*;

public class Main {
    public static void main(String ags[]) {
        Scanner cin = new Scanner(System.in);
        int l = cin.nextInt();
        char c = cin.next().charAt(0);
        double mp[][] = new double[13][13];
        for (int i = 1; i <= 12; i++)
            for (int j = 1; j <= 12; j++)
                mp[i][j] = cin.nextDouble();
        double sum = 0;
        for (double x : mp[l + 1])
            sum += x;
        if (c == 'S')
            System.out.printf("%.1f", sum);
        else
            System.out.printf("%.1f", sum / 12.0);
    }
}



活动打卡代码 AcWing 739. 数组选择

heng-
11小时前
import java.util.*;

public class Main {
    public static void main(String ags[]) {
        Scanner cin = new Scanner(System.in);
        double a[] = new double[100];
        for (int i = 0; i < 100; i++) {
            a[i] = cin.nextDouble();
            if (a[i] <= 10)
                System.out.println("A[" + i + "] = " + String.format("%.1f", a[i]));
        }
    }
}



活动打卡代码 AcWing 738. 数组填充

heng-
11小时前
import java.util.*;

public class Main {
    public static void main(String ags[]) {
        Scanner cin = new Scanner(System.in);
        int n = cin.nextInt();
        int a[] = new int[10];
        for (int i = 0; i < 10; i++) {
            a[i] = n;
            n *= 2;
            System.out.println("N[" + i + "] = " + a[i]);
        }
    }
}



活动打卡代码 AcWing 737. 数组替换

heng-
13小时前
import java.util.*;

public class Main {
    public static void main(String ags[]) {
        Scanner cin = new Scanner(System.in);
        int a[] = new int[10];
        for (int i = 0; i < 10; i++) {
            a[i] = cin.nextInt();
            if (a[i] <= 0)
                a[i] = 1;
            System.out.println("X[" + i + "] = " + a[i]);
        }
    }
}



活动打卡代码 AcWing 727. 菱形

heng-
13小时前
import java.util.*;

public class Main {
    public static void main(String ags[]) {
        Scanner cin = new Scanner(System.in);
        int n = cin.nextInt();
        char mp[][] = new char[n + 1][n + 1];
        int len = n, mid = n / 2 + 1;
        for (int i = 1; i <= len; i++)
            mp[mid][i] = '*';
        int l = mid - 1, r = mid + 1;

        while (l >= 1 && r <= n) {
            len -= 2;
            mp[l][mid] = mp[r][mid] = '*';
            for (int i = 1; i <= len / 2; i++)
                mp[l][mid - i] = mp[r][mid - i] = mp[r][mid + i] = mp[l][mid + i] = '*';
            l--;
            r++;
        }
        int cnt = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                if (mp[i][j] == 0)
                    mp[i][j] = ' ';
                System.out.print(mp[i][j]);
            }
            System.out.println();
        }
    }
}



活动打卡代码 AcWing 726. 质数

heng-
13小时前
import java.util.*;

public class Main {
    public static void main(String ags[]) {
        Scanner cin = new Scanner(System.in);
        int n = cin.nextInt();
        while (n-- > 0) {
            int x = cin.nextInt();
            boolean ok = true;
            for (int i = 2; i * i <= x && ok; i++)
                if (x % i == 0)
                    ok = false;
            System.out.println(x + (ok ? " is " : " is not ") + "prime");
        }
    }
}