에서 AtCoder Beginners Selection (ABC085C - Otoshidama)
준비
C#에서 AtCoder 데뷔 준비
나중에 AtCoder Beginners Selection을 해 보았습니다.
문제문
ABC085C - 오토시다마
h tps // 아 t 여기 r. jp / sts / abs / sks / abc085_c
제출 결과
using System;
using System.Linq;
class Program
{
static void Main(string[] args)
{
long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
long N = array[0];
long Y = array[1] / 1000;
long x = -1;
long y = -1;
long z = -1;
bool ari = false;
for (long ix = N; ix >= 0; ix--)
{
for (long iy = N - ix; iy >= 0; iy--)
{
long iz = N - ix - iy;
if ((10 * ix) + (5 * iy) + iz == Y)
{
x = ix;
y = iy;
z = iz;
ari = true;
break;
}
}
if (ari) break;
}
Console.WriteLine($"{x} {y} {z}");
}
}
테스트 실행




Reference
이 문제에 관하여(에서 AtCoder Beginners Selection (ABC085C - Otoshidama)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/azumabashi/items/e4d6f7320c4dbc1da2b3텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)