一共19道题
虽然是java写的,但是还是用的类似于C的结构体
下面代码供参考

每题前面标的有题号
*1180 成绩统计(结构体专题)
1181 谁的年龄最小(结构体专题)
1182 查询记录(结构体专题)
1183 平面点排序(一)(结构体专题)
1184 平面点排序(二)(结构体专题)
1185 添加记录(结构体专题)
1186 删除记录(结构体专题)
1187 棒棒糖(结构体专题)
1188 选票统计(一)(结构体专题)
1189 选票统计(二)(结构体专题)
1190 按出生日期排序(结构体专题)
1191 数星星(结构体专题)
1192 奖学金(结构体专题)
1193 单科成绩排序(结构体专题)
1194 总成绩排序(结构体专题)
1195 猴子选大王(结构体专题)
1196 数星星(二)(结构体专题)
1197 考试排名(一)(结构体专题)
1198 考试排名(二)(结构体专题)

1180
import**** java.util.Scanner;class student
{long num;String name;int x, y, z;int sum;
}public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(System.in);student[] a = new student[110];int n, max = 0;n = cin.nextInt();for (int i = 1; i <= n; i++)a[i] = new student();for (int i = 1; i <= n; i++){a[i].num = cin.nextLong();a[i].name = cin.next();a[i].x = cin.nextInt();a[i].y = cin.nextInt();a[i].z = cin.nextInt();a[i].sum = a[i].x + a[i].y + a[i].z;max = Math.max(a[i].sum, max);}for (int i = 1; i <= n; i++){if (a[i].sum == max){System.out.println(a[i].num + " " + a[i].name + " " + a[i].x + " " + a[i].y + " " + a[i].z);break;}}}
}1181
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;class friend
{String name;int x, y, z;
}public class Main
{public static int check(friend a, friend b) {if (a.x != b.x){if (a.x > b.x)return 1;elsereturn 0;} else{if (a.y != b.y){if (a.y > b.y)return 1;elsereturn 0;} else{if (a.z > a.z)return 1;elsereturn 0;}}}public static void main(String[] args) {Scanner cin = new Scanner(System.in);int n;n = cin.nextInt();friend a[] = new friend[11];for (int i = 0; i <= 10; i++)a[i] = new friend();for (int i = 0; i < n; i++){a[i].name = cin.next();a[i].x = cin.nextInt();a[i].y = cin.nextInt();a[i].z = cin.nextInt();}friend ans = new friend();ans.name = a[0].name;ans.x = a[0].x;ans.y = a[0].y;ans.z = a[0].z;for (int i = 1; i < n; i++){if (check(a[i], ans) == 1)ans = a[i];}System.out.printf("%s %d-%02d-%02d", ans.name, ans.x, ans.y, ans.z);}
}
1182
import java.util.Scanner;class student
{long num;String name;int x, y, z;int sum;
}public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(System.in);student[] a = new student[110];int n, max = 0;n = cin.nextInt();for (int i = 1; i <= n; i++)a[i] = new student();for (int i = 1; i <= n; i++){a[i].num = cin.nextLong();a[i].name = cin.next();a[i].x = cin.nextInt();a[i].y = cin.nextInt();a[i].z = cin.nextInt();a[i].sum = a[i].x + a[i].y + a[i].z;max = Math.max(a[i].sum, max);}int flag = 0;long qury = cin.nextLong();for (int i = 1; i <= n; i++){if (a[i].num == qury){System.out.println(a[i].num + " " + a[i].name + " " + a[i].x + " " + a[i].y + " " + a[i].z);flag = 1;break;}}if (flag == 0)System.out.println("Not Found");}
}1183import java.util.Scanner;class node
{int x, y, z;
}public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(System.in);int n;n = cin.nextInt();node[] a = new node[11];for (int i = 1; i <= 10; i++)a[i] = new node();for (int i = 1; i <= n; i++){a[i].x = cin.nextInt();a[i].y = cin.nextInt();a[i].z = a[i].x * a[i].x + a[i].y * a[i].y;}for (int i = 1; i < n; i++)for (int j = 1; j < n; j++){if (a[j].z > a[j + 1].z){node t = a[j];a[j] = a[j + 1];a[j + 1] = t;}}for (int i = 1; i <= n; i++)System.out.print("(" + a[i].x + "," + a[i].y + ") ");}
}1184import java.util.Scanner;class node
{int x, y;
}public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(System.in);int n;n = cin.nextInt();node[] a = new node[1100];for (int i = 1; i <= 110; i++)a[i] = new node();for (int i = 1; i <= n; i++){a[i].x = cin.nextInt();a[i].y = cin.nextInt();}for (int i = 1; i < n; i++)for (int j = 1; j <= n - i; j++){if (a[j].x == a[j + 1].x){if (a[j].y > a[j + 1].y){node t = a[j];a[j] = a[j + 1];a[j + 1] = t;}} else if (a[j].x > a[j + 1].x){node t = a[j];a[j] = a[j + 1];a[j + 1] = t;}}for (int i = 1; i <= n; i++)System.out.print("(" + a[i].x + "," + a[i].y + ") ");System.out.println();for (int i = n; i >= 1; i--)System.out.print("(" + a[i].x + "," + a[i].y + ") ");}
}1185import java.util.Scanner;class node
{long num;String name;int x, y, z;
}public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(System.in);int n;n = cin.nextInt();node[] a = new node[1010];for (int i = 1; i <= 1000; i++)a[i] = new node();for (int i = 1; i <= n; i++){a[i].num = cin.nextLong();a[i].name = cin.next();a[i].x = cin.nextInt();a[i].y = cin.nextInt();a[i].z = cin.nextInt();}int flag = 0;n++;a[n].num = cin.nextLong();a[n].name = cin.next();a[n].x = cin.nextInt();a[n].y = cin.nextInt();a[n].z = cin.nextInt();for (int i = 1; i <= n - 1; i++){if (a[i].num == a[n].num){flag = 1;break;}}if (flag == 1)System.out.println("error!");else{for (int i = 1; i < n; i++){for (int j = 1; j < n; j++){if (a[j].num > a[j + 1].num){node t = a[j];a[j] = a[j + 1];a[j + 1] = t;}}}for (int i = 1; i <= n; i++)System.out.println(a[i].num + " " + a[i].name + " " + a[i].x + " " + a[i].y + " " + a[i].z);}}
}1186import java.util.Scanner;class node
{long num;String name;int x, y, z;
}public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(System.in);int n;n = cin.nextInt();node[] a = new node[1010];for (int i = 1; i <= 1000; i++)a[i] = new node();for (int i = 1; i <= n; i++){a[i].num = cin.nextLong();a[i].name = cin.next();a[i].x = cin.nextInt();a[i].y = cin.nextInt();a[i].z = cin.nextInt();}int flag = 0;long qury = cin.nextLong();for (int i = 1; i <= n; i++){if (a[i].num == qury){flag = 1;break;}}if (flag == 0)System.out.println("error!");else{for (int i = 1; i <= n; i++)if (a[i].num != qury)System.out.println(a[i].num + " " + a[i].name + " " + a[i].x + " " + a[i].y + " " + a[i].z);elsecontinue;}}
}
1187import java.util.Scanner;class node
{double x, y;
}public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(System.in);int all;int n;all = cin.nextInt();n = cin.nextInt();node[] a = new node[110];for (int i = 1; i <= 15; i++)a[i] = new node();for (int i = 1; i <= n; i++){a[i].x = cin.nextDouble();a[i].y = cin.nextDouble();}for (int i = 1; i < n; i++)for (int j = 1; j <= n - i; j++){if (a[j].x > a[j + 1].x){node t = a[j + 1];a[j + 1] = a[j];a[j] = t;}}double cost = 0;for (int i = 1; i <= n; i++){if (all > a[i].y){cost += a[i].x * a[i].y;all -= a[i].y;} else{cost += a[i].x * all;break;}}System.out.printf("%.2f", cost);}
}1188import java.util.Scanner;public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(System.in);int n;int[] a = new int[10];String[] b = { "", "zhang", "wang", "zhao", "liu", "miao" };n = cin.nextInt();for (int i = 1; i <= n; i++){String name;name = cin.next();if (name.compareTo("zhang") == 0)a[1]++;if (name.compareTo("wang") == 0)a[2]++;if (name.compareTo("zhao") == 0)a[3]++;if (name.compareTo("liu") == 0)a[4]++;if (name.compareTo("miao") == 0)a[5]++;// System.out.println(i+" "+name);}for (int i = 1; i <= 5; i++){System.out.println(b[i] + " " + a[i]);}}
}1189import java.util.Scanner;class node {String name;int num;
}public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(System.in);//String[] a = new String [510];int k = 0;node [] a= new node[530];for(int i = 1 ;i <= 510;i++)a[i] = new node ();int max=0;while(cin.hasNext()){int flag=0;String name = cin.next();if(name.compareTo("#")==0)break;for(int i = 1;i<=k;i++){if(name.compareTo(a[i].name)==0){flag=1;a[i].num++;max=Math.max(max, a[i].num);}}if(flag==0){a[++k].name=name;a[k].num++;max=Math.max(max, a[k].num);}}for(int i = 1;i<=k;i++)if(a[i].num==max){System.out.println(a[i].name);break;}}}1190import java.util.Scanner;class node
{String name;int a, b, c;
}public class Main
{public static void main(String[] args) {int n;Scanner cin = new Scanner(System.in);n = cin.nextInt();node[] a = new node[110];for (int i = 1; i <= 100; i++)a[i] = new node();for (int i = 1; i <= n; i++){a[i].name = cin.next();a[i].a = cin.nextInt();a[i].b = cin.nextInt();a[i].c = cin.nextInt();}for (int i = 1; i < n; i++)for (int j = 1; j <= n - i; j++){if (a[j].b == a[j + 1].b){if (a[j].c > a[j + 1].c){node t = a[j];a[j] = a[j + 1];a[j + 1] = t;}} else if (a[j].b > a[j + 1].b){node t = a[j];a[j] = a[j + 1];a[j + 1] = t;}}for (int i = 1; i <= n; i++)System.out.printf("%s %d-%02d-%02d\n", a[i].name, a[i].a, a[i].b, a[i].c);}
}1191import java.util.Scanner;class node
{int x, y;
}public class Main
{public static void main(String[] args) {int n;Scanner cin = new Scanner(System.in);n = cin.nextInt();int k = 0;node[] a = new node[310];for (int i = 1; i <= 300; i++)a[i] = new node();for (int i = 1; i <= n; i++){int flag = 0;int x, y;x = cin.nextInt();y = cin.nextInt();for (int j = 1; j <= k; j++){if (a[j].x == x && a[j].y == y){flag = 1;break;}}if (flag == 0){a[++k].x = x;a[k].y = y;}}System.out.println(k);}
}1192import java.util.Scanner;class node
{String name;int a, b;int x, y, z;int sum;
}public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(System.in);int n;n = cin.nextInt();node[] a = new node[110];for (int i = 1; i <= 100; i++)a[i] = new node();int max = 0, total = 0;for (int i = 1; i <= n; i++){a[i].name = cin.next();a[i].a = cin.nextInt();a[i].b = cin.nextInt();String c = cin.nextLine();if (c.charAt(1) == 'Y')a[i].x = 1;elsea[i].x = 0;if (c.charAt(3) == 'Y')a[i].y = 1;elsea[i].y = 0;if (c.length() == 7)a[i].z = 10;else{a[i].z = c.charAt(5) - '0';}if (a[i].a > 80 && a[i].z >= 1)a[i].sum += 8000;if (a[i].a > 85 && a[i].b > 80)a[i].sum += 4000;if (a[i].a > 90)a[i].sum += 2000;if (a[i].a > 85 && a[i].y == 1)a[i].sum += 1000;if (a[i].b > 80 && a[i].x == 1)a[i].sum += 850;// System.out.println(a[i].x+" "+a[i].y+" "+a[i].z);total += a[i].sum;max = Math.max(max, a[i].sum);}for (int i = 1; i <= n; i++){if (a[i].sum == max){System.out.println(a[i].name + "\n" + a[i].sum + "\n" + total);break;}}}
}1193import java.util.Scanner;class node
{long num;String name;int a, b, c;
}public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(System.in);int n;n = cin.nextInt();node[] a = new node[110];for (int i = 1; i <= 100; i++)a[i] = new node();for (int i = 1; i <= n; i++){a[i].num = cin.nextLong();a[i].name = cin.next();a[i].a = cin.nextInt();a[i].b = cin.nextInt();a[i].c = cin.nextInt();}int flag;flag = cin.nextInt();if (flag == 1){for (int i = 1; i <= n; i++)for (int j = 1; j <= n - i; j++){if (a[j].a == a[j + 1].a){if (a[j].num > a[j + 1].num){node t = a[j + 1];a[j + 1] = a[j];a[j] = t;}} else if (a[j].a < a[j + 1].a){node t = a[j + 1];a[j + 1] = a[j];a[j] = t;}}}if (flag == 2){for (int i = 1; i <= n; i++)for (int j = 1; j <= n - i; j++){if (a[j].b == a[j + 1].b){if (a[j].num > a[j + 1].num){node t = a[j + 1];a[j + 1] = a[j];a[j] = t;}} else if (a[j].b < a[j + 1].b){node t = a[j + 1];a[j + 1] = a[j];a[j] = t;}}}if (flag == 3){for (int i = 1; i <= n; i++)for (int j = 1; j <= n - i; j++){if (a[j].c == a[j + 1].c){if (a[j].num > a[j + 1].num){node t = a[j + 1];a[j + 1] = a[j];a[j] = t;}} else if (a[j].c < a[j + 1].c){node t = a[j + 1];a[j + 1] = a[j];a[j] = t;}}}for (int i = 1; i <= n; i++)System.out.println(a[i].num + " " + a[i].name + " " + a[i].a + " " + a[i].b + " " + a[i].c);}
}1194import java.util.Scanner;class node
{long num;String name;int a, b, c, sum;
}public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(System.in);int n;n = cin.nextInt();node[] a = new node[110];for (int i = 1; i <= 100; i++)a[i] = new node();for (int i = 1; i <= n; i++){a[i].num = cin.nextLong();a[i].name = cin.next();a[i].a = cin.nextInt();a[i].b = cin.nextInt();a[i].c = cin.nextInt();a[i].sum = a[i].a + a[i].b + a[i].c;}for (int i = 1; i <= n; i++)for (int j = 1; j <= n - i; j++){if (a[j].sum == a[j + 1].sum){if (a[j].name.compareTo(a[j + 1].name) > 0){node t = a[j + 1];a[j + 1] = a[j];a[j] = t;}} else if (a[j].sum < a[j + 1].sum){node t = a[j + 1];a[j + 1] = a[j];a[j] = t;}}for (int i = 1; i <= n; i++)System.out.println(a[i].num + " " + a[i].name + " " + a[i].a + " " + a[i].b + " " + a[i].c + " " + a[i].sum);}
}1195import java.util.Arrays;
import java.util.Scanner;public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(System.in);int n, m, ans = 0;n = cin.nextInt();m = cin.nextInt();for (int i = 1; i <= n; i++)ans = (ans + m) % i;System.out.println(ans + 1);}
}
1196import java.util.Arrays;
import java.util.Scanner;class node
{double x, y;
}public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(System.in);int n;int[] b = new int[100010];node[] a = new node[510];n = cin.nextInt();for (int i = 1; i <= 500; i++)a[i] = new node();for (int i = 1; i <= n; i++){a[i].x = cin.nextDouble();a[i].y = cin.nextDouble();}int k = 0;int ans = 0;for (int i = 1; i < n; i++){int cnt = 0;for (int j = i + 1; j <= n; j++){for (int u = 1; u <= n; u++){if ((a[j].x - a[i].x) * (a[u].y - a[i].y) == (a[u].x - a[i].x) * (a[j].y - a[i].y)){b[k]++;}}k++;}}// System.out.println(k);Arrays.sort(b, 0, k);System.out.println(b[k - 1]);}
}1197import java.util.Arrays;
import java.util.Scanner;class node
{String name;int sum;
}public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(System.in);int[] s = new int[20];node[] a = new node[1110];for (int i = 1; i <= 1000; i++)a[i] = new node();int n, m, g, x = 0;n = cin.nextInt();m = cin.nextInt();g = cin.nextInt();for (int i = 1; i <= m; i++){s[i] = cin.nextInt();}for (int i = 1; i <= n; i++){int sum = 0;String name = cin.next();int k = cin.nextInt();for (int j = 1; j <= k; j++){int d;d = cin.nextInt();sum += s[d];}node use = new node();use.name = name;use.sum = sum;a[++x] = use;}for (int i = 1; i <= n; i++)for (int j = 1; j <= n - i; j++){if (a[j].sum == a[j + 1].sum){if (a[j].name.compareTo(a[j + 1].name) > 0){node t = a[j + 1];a[j + 1] = a[j];a[j] = t;}} else if (a[j].sum < a[j + 1].sum){node t = a[j + 1];a[j + 1] = a[j];a[j] = t;}}int cnt = 0;for (int i = 1; i <= n; i++){if (a[i].sum < g)break;elsecnt++;}System.out.println(cnt);for (int i = 1; i <= cnt; i++)System.out.println(a[i].name + " " + a[i].sum);}
}1198import java.util.Arrays;
import java.util.Scanner;class node
{String name;int num;int sum;
}public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(System.in);node[] a = new node[1100];for (int i = 1; i <= 1000; i++)a[i] = new node();int n, k = 0;n = cin.nextInt();while (cin.hasNext()){String name = cin.next();int time = 0, cnt = 0;for (int i = 1; i <= n; i++){int sum = 0;int num = 0;String s = cin.next();String[] b = s.split("\\(|\\)");if (b.length == 1)sum = Integer.parseInt(s);else{sum = Integer.parseInt(b[0]);num = Integer.parseInt(b[1]);}if (sum > 0){cnt++;time += sum + num * 20;}}// System.out.println(name+" "+cnt+" "+time);a[++k].name = name;a[k].num = cnt;a[k].sum = time;}for (int i = 1; i <= k; i++)for (int j = 1; j <= k - i; j++){if (a[j].num == a[j + 1].num){if (a[j].sum == a[j + 1].sum){if (a[j].name.compareTo(a[j + 1].name) > 0){node t = a[j + 1];a[j + 1] = a[j];a[j] = t;}} else if (a[j].sum > a[j + 1].sum){node t = a[j + 1];a[j + 1] = a[j];a[j] = t;}} else if (a[j].num < a[j + 1].num){node t = a[j + 1];a[j + 1] = a[j];a[j] = t;}}for (int i = 1; i <= k; i++)System.out.printf("%-10s %2d %4d\n", a[i].name, a[i].num, a[i].sum);}
}

ZZULIOJ 1180-1198结构体专题 参考代码相关推荐

  1. 向大佬学习C语言1198: 考试排名(二)(结构体专题)

    题目 1198: 考试排名(二)(结构体专题) 时间限制: 1 Sec 内存限制: 128 MB 提交: 3737 解决: 728ACM 国际大学生程序设计竞赛,英文全称:ACM Internatio ...

  2. 1198: 考试排名(二)(结构体专题)

    1198: 考试排名(二)(结构体专题) 题目描述 ACM 国际大学生程序设计竞赛,英文全称:ACM International Collegiate Programming Contest(ACM- ...

  3. ZZULIOJ: 1187: 棒棒糖(结构体专题)

    1187: 棒棒糖(结构体专题) 时间限制: 1 Sec 内存限制: 128 MB 提交: 1006 解决: 790 [提交] [状态] [讨论版] [命题人:外部导入] 题目描述 新年快到了,计算机 ...

  4. zzulioj:1196: 数星星(二)(结构体专题)

    1196: 数星星(二)(结构体专题) 时间限制: 1 Sec 内存限制: 128 MB 提交: 2993 解决: 964 [状态] [讨论版] [提交] [命题人:外部导入] 题目描述 一天,小明坐 ...

  5. ZZULIOJ1198: 考试排名(二)(结构体专题)

    1198: 考试排名(二)(结构体专题) 题目描述: ACM 国际大学生程序设计竞赛,英文全称:ACM International Collegiate Programming Contest(ACM ...

  6. 结构体复数相乘c语言,复数乘法中的结构体赋值实现代码

    复数乘法中的结构体赋值实现代码 废话不多说,直接上代码 复制代码 代码如下: #include using namespace std; typedef struct { double real; d ...

  7. ZZULIOJ1194: 总成绩排序(结构体专题)

    1194: 总成绩排序(结构体专题) 题目描述: 有一学生成绩表,包括学号.姓名.3门课程成绩.请按如下规则排序:按总成绩降序排序,若总成绩相同,则按姓名升序排序. 输入: 首先输入一个整数n(1&l ...

  8. 考试排名(结构体专题)

    考试排名(结构体专题) 题目描述 今天浙大研究生复试的上机考试跟传统笔试的打分规则相似,总共有n道题,每道题有对应分值,最后计算总成绩.现给定录取分数线,请你写程序找出最后通过分数线的考生,并将他们的 ...

  9. 1481: 考试排名(一)(结构体专题)

    1481: 考试排名(一)(结构体专题) 1.描述 今天浙大研究生复试的上机考试跟传统笔试的打分规则相似,总共有n道题,每道题有对应分值,最后计算总成绩.现给定录取分数线,请你写程序找出最后通过分数线 ...

最新文章

  1. jquery click 第一次没用_【通知】同济大学研究生会20202021学年第一次主席联席会...
  2. python 数据字典用法_python数据字典的操作
  3. JQuery EasyUI之DataGrid列名和数据列分别设置不同对齐方式(转)
  4. 并查集——村村通(洛谷 P1536)
  5. html中如何多列布局,CSS3 多列布局
  6. return、reutrn false、e.preventDefault、e.stopPropagation、e.stopImmediatePropagation的区别
  7. 【啊哈!算法】算法6:只有五行的Floyd最短路算法
  8. 在lua中优雅的操作日期和时间
  9. W12Scan:一款功能强大的网络安全资产扫描引擎
  10. python 实现 BCH 纠错码的方法
  11. SQL Server 修改字段名
  12. 简单理解网页源码(HTML源代码)
  13. 基于STM32MP1的IOT参考设计(采用QT和web技术)
  14. 洛谷 P4188 [USACO18JAN]Lifeguards (线段树)
  15. 【Python】多图形混合排版,如何在Matplotlib/Seaborn中实现?
  16. 新学期,这里有教师必备的教学神器,你会用吗?
  17. 博途v15模拟量转换_通过实例玩转博途之信号模块参数设置及模拟量输入转换举例...
  18. IIS 服务器常见漏洞
  19. 0.91英寸OLED初始化程序
  20. Latex/WinEdt中文编辑

热门文章

  1. 万言万当,不如一默为官之道
  2. 如何判断ABAP程序前台还是后台运行[sy-batch]
  3. 设置ListView中的所有Item均不可点击
  4. TOEFL-Write-课堂笔记
  5. MYSQL的sqlca详解_sql数据库如何使用
  6. 深信服上网行为管理开启snmp_深信服上网行为管理部署方式及功能实现配置说明....
  7. 用豆瓣源安装pytorch1.5.1(速度很快)
  8. Go实战 | 一文带你搞懂从单队列到优先级队列的实现
  9. Java Selenium3 WebDriver启动火狐、Chrome、IE,Edge浏览器的方法(一)
  10. 汇编语言(四)-8086的指令系统