/ @@18khV /

记录详情

Compile Error

foo.cc: In function 'int main()':
foo.cc:9:25: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} [-Wformat=]
    9 |                 scanf("%d%d%d%d%d%d", &name, &s1, &s2, &a, &b, &x);
      |                        ~^             ~~~~~
      |                         |             |
      |                         int*          std::string* {aka std::__cxx11::basic_string<char>*}
foo.cc:9:31: warning: format '%d' expects argument of type 'int*', but argument 5 has type 'char*' [-Wformat=]
    9 |                 scanf("%d%d%d%d%d%d", &name, &s1, &s2, &a, &b, &x);
      |                              ~^                        ~~
      |                               |                        |
      |                               int*                     char*
      |                              %hhd
foo.cc:9:33: warning: format '%d' expects argument of type 'int*', but argument 6 has type 'char*' [-Wformat=]
    9 |                 scanf("%d%d%d%d%d%d", &name, &s1, &s2, &a, &b, &x);
      |                                ~^                          ~~
      |                                 |                          |
      |                                 int*                       char*
      |                                %hhd
foo.cc:11:31: error: 'score2' was not declared in this scope
   11 |                 if(s1 > 85 && score2 > 80) sum += 4000;
      |                               ^~~~~~
foo.cc:16:26: error: 'maxx' was not declared in this scope; did you mean 'maxn'?
   16 |                 if(sum > maxx) maxn = name, maxx = sum; sum = 0;
      |                          ^~~~
      |                          maxn
foo.cc:16:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   16 |                 if(sum > maxx) maxn = name, maxx = sum; sum = 0;
      |                 ^~
foo.cc:16:57: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   16 |                 if(sum > maxx) maxn = name, maxx = sum; sum = 0;
      |                                                         ^~~
foo.cc:18:38: error: 'maxx' was not declared in this scope; did you mean 'maxn'?
   18 |         printf("%d\n%d\n%d\n", maxn, maxx, tot);
      |                                      ^~~~
      |                                      maxn
foo.cc:4:33: warning: unused variable 'max' [-Wunused-variable]
    4 |         int n, s1, s2, sum = 0, max = 0, tot = 0, x;
      |                                 ^~~
[Hydro](https://hydro.ac)提供评测服务

代码

#include<bits/stdc++.h>
using namespace std;
int main() {
	int n, s1, s2, sum = 0, max = 0, tot = 0, x;
	char a, b;
	string name, maxn;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) {
		scanf("%d%d%d%d%d%d", &name, &s1, &s2, &a, &b, &x);
		if(s1 > 80 && x > 0) sum += 8000;
		if(s1 > 85 && score2 > 80) sum += 4000;
		if(s1 > 90) sum += 2000;
		if(s1 > 85 && b == 'Y') sum += 1000;
		if(s2 > 80 && a == 'Y') sum += 850;
		tot += sum;
		if(sum > maxx) maxn = name, maxx = sum; sum = 0;
	}
	printf("%d\n%d\n%d\n", maxn, maxx, tot);
	return 0;
}

信息

递交者
类型
递交
题目
P1000 谁拿了最多奖学金
题目数据
下载
语言
C++
递交时间
2020-11-06 19:21:37
评测时间
2023-09-05 13:30:22
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes