Submission #2532093
Source Code Expand
#include<stdio.h> int main(void){ int n ,i ,j ,total = 0, max = 0; scanf("%d",&n); int a[2][n]; for(i = 0; i < 2;i++){ for(j = 0; j < n ;j++){ scanf("%d",&a[i][j]); } } for(i = 0; i < n; i++){ // i<=jなら二段目の計算 for(j = 0; j < n; j++){ if(i <= j){ total += a[1][j]; }else{ total += a[0][j]; } } total += a[0][i]; max = (max > total) ? max : total; total = 0; } printf("%d",max); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Candies |
User | shop_one |
Language | C (GCC 5.4.1) |
Score | 300 |
Code Size | 535 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 128 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:4:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.c:8:7: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&a[i][j]); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample01.txt, sample02.txt, sample03.txt, sample04.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, sample01.txt, sample02.txt, sample03.txt, sample04.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 1 ms | 128 KB |
02.txt | AC | 1 ms | 128 KB |
03.txt | AC | 1 ms | 128 KB |
04.txt | AC | 1 ms | 128 KB |
05.txt | AC | 1 ms | 128 KB |
06.txt | AC | 0 ms | 128 KB |
07.txt | AC | 0 ms | 128 KB |
08.txt | AC | 0 ms | 128 KB |
09.txt | AC | 1 ms | 128 KB |
10.txt | AC | 1 ms | 128 KB |
11.txt | AC | 1 ms | 128 KB |
12.txt | AC | 1 ms | 128 KB |
sample01.txt | AC | 0 ms | 128 KB |
sample02.txt | AC | 0 ms | 128 KB |
sample03.txt | AC | 0 ms | 128 KB |
sample04.txt | AC | 0 ms | 128 KB |