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

Affiliate Disclosure: This post contains Amazon affiliate links. If you purchase through these links, eBlogarithm may earn a commission at no extra cost to you. Prices and availability are subject to change.

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;
}

📦 Looking for Codeforces Round 381 Div Problem Alyona? Check the best deals on Amazon.

🛒 Shop Codeforces Round 381 Div Problem Alyona on Amazon

As an Amazon Associate, eBlogarithm earns from qualifying purchases. Prices and availability are subject to change.

Affiliate Disclosure: This post contains Amazon affiliate links. If you purchase through these links, eBlogarithm may earn a commission at no extra cost to you. Prices and availability are subject to change.

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;
}

📦 Looking for Codeforces Round 381 Div Problem Alyona? Check the best deals on Amazon.

🛒 Shop Codeforces Round 381 Div Problem Alyona on Amazon

As an Amazon Associate, eBlogarithm earns from qualifying purchases. Prices and availability are subject to change.

More from author

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Related posts

Advertismentspot_img

Latest posts

DELIVAN to Unveil Production Models at IAA Transportation 2026

The commercial vehicle sector in Europe is on the brink of an exciting transformation as DELIVAN, the dedicated European-focused van brand established by global...

The Real Truth About Viral Kitchen Gadgets Before You Buy

📢 As an Amazon Associate, I earn from qualifying purchases.After putting the Viral Kitchen Gadgets through a proper 30-day real-world test, I can tell...

Tiger Woods pleads no contest to reckless driving charge in Florida

Golf legend Tiger Woods has entered a formal plea in a Florida courtroom, bringing an end to months of legal uncertainty following a serious...

Want to stay up to date with the latest news?

We would love to hear from you! Please fill in your details and we will stay in touch. It's that simple!