Submission #855726


Source Code Expand

Copy
#include<stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{

        int n;
        int k;
        int x;
        int y;
        int sum;
        int i;


	// 個数のの入力
        sum = 0;
        scanf("%d %d %d %d",&n,&k,&x,&y);

        for (i = 0,i < n, i++) {
          if (i < k ) {
           sum = sum + x;
          }
          else
           sum = sum + y;
          }  
        } 

	printf("%d|n",sum);

        
	return 0;
}

Submission Info

Submission Time
Task A - 高橋君とホテルイージー / Tak and Hotels (ABC Edit)
User hirotarou
Language C (GCC 5.4.1)
Score 0
Code Size 485 Byte
Status

Compile Error

./Main.c: In function ‘main’:
./Main.c:19:30: error: expected ‘;’ before ‘)’ token
         for (i = 0,i < n, i++) {
                              ^
./Main.c:19:30: error: expected expression before ‘)’ token
./Main.c: At top level:
./Main.c:28:9: error: expected declaration specifiers or ‘...’ before string constant
  printf("%d|n",sum);
         ^
./Main.c:28:16: error: unknown type name ‘sum’
  printf("%d|n",sum);
                ^
./Main.c:31:2: error: expected identifier or ‘(’ before ‘return’
  return 0;
  ^
./Main.c:32:1: error: expected identifier or ‘(’ before ‘}’ token
 }
 ^
./Main.c: In function ‘main’:
./Main.c:17:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d %d",&n,&k,&x,&y);
         ^