https://i2.wp.com/eblogarithm.com/wp-content/uploads/2016/11/Codeforces-Round-381-Div-2-problem-A-Alyona-and-copybooks-Solution-in-CC1.png?fit=640%2C360

Codeforces Round #381 (Div. 2), problem: (A) Alyona and copybooks Solution in C/C++

Hi guys , I just solved the first problem of round 381 , Hope you like it , feel free to comment any better solution .

 

#include<stdio.h>

int main() {
int n,a[5]={0};
scanf(“%d %d %d %d”,&n,&a[1],&a[2],&a[3]);
if (a[3]+a[3]<a[1]-a[3]) a[1]=a[3]+a[3]+a[3];
if (a[3]+a[2]<a[1]) a[1]=a[3]+a[2];
if (a[3]+a[3]<a[2]) a[2]=a[3]+a[3];
if (a[1]+a[1]<a[2]) a[2]=a[1]+a[1];
if (a[1]+a[2]<a[3]) a[3]=a[1]+a[2];
a[4]=0;
printf(“%d\n”,a[4-n%4]);
return 0;
}

(Visited 96 times, 1 visits today)



There are no comments

Add yours

Leave a Reply

%d bloggers like this: