Submission #6313857


Source Code Expand

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class B
{
	public static void Main()
	{
		double R = GetDouble();
		int N = GetInt();
		int M = GetInt();

		double[] len = new double[N + M];
		for(int i = 1; i <= (double)N / 2.0; i++)
		{
			len[i] = 2.0 * Math.Sqrt(R * R - Math.Pow(R - i * 2.0 * R / (double)N, 2.0));
			len[N - i] = len[i];
		}

		double ans = 0;
		for(int i = - M + 1; i < N; i++)
			ans += Math.Max((i >= 0) ? len[i] : 0.0, len[i + M]);
		Console.WriteLine($"{ans:F12}");
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}

Submission Info

Submission Time
Task B - ステップカット
User DM7PvTyc
Language C# (Mono 4.6.2.0)
Score 200
Code Size 1182 Byte
Status AC
Exec Time 25 ms
Memory 13280 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 16
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt, 00_example_03.txt
All 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 10_rand_01.txt, 10_rand_02.txt, 10_rand_03.txt, 10_rand_04.txt, 10_rand_05.txt, 10_rand_06.txt, 10_rand_07.txt, 10_rand_08.txt, 20_hand_01.txt, 20_hand_02.txt, 20_hand_03.txt, 20_hand_04.txt, 20_hand_05.txt
Case Name Status Exec Time Memory
00_example_01.txt AC 22 ms 11220 KB
00_example_02.txt AC 21 ms 11092 KB
00_example_03.txt AC 23 ms 11744 KB
10_rand_01.txt AC 21 ms 9044 KB
10_rand_02.txt AC 21 ms 9044 KB
10_rand_03.txt AC 23 ms 13280 KB
10_rand_04.txt AC 21 ms 11092 KB
10_rand_05.txt AC 20 ms 9116 KB
10_rand_06.txt AC 21 ms 11184 KB
10_rand_07.txt AC 21 ms 9016 KB
10_rand_08.txt AC 21 ms 9056 KB
20_hand_01.txt AC 24 ms 11744 KB
20_hand_02.txt AC 25 ms 11616 KB
20_hand_03.txt AC 24 ms 13116 KB
20_hand_04.txt AC 21 ms 11092 KB
20_hand_05.txt AC 21 ms 11092 KB