提出 #58710377


ソースコード 拡げる

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e6;
int n;
double sum=0;
struct node{
	int x,y;
}a[N];
double dst(int x,int xx,int y,int yy){
	return sqrt((x-xx)*(x-xx)+(y-yy)*(y-yy));
}
signed main()
{
	cin>>n;
	sum+=dst(0,a[1].x,0,a[1].y);
	for(int i=1;i<=n;i++){
		cin>>a[i].x>>a[i].y;
		sum+=dst(a[i].x,a[i-1].x,a[i].y,a[i-1].y);
	}
	sum+=dst(0,a[n].x,0,a[n].y);
	printf("%.7lf\n",sum);
	return 0;
}

提出情報

提出日時
問題 B - Traveling Takahashi Problem
ユーザ Sin_qwq
言語 C++ 20 (gcc 12.2)
得点 150
コード長 458 Byte
結果 AC
実行時間 113 ms
メモリ 6904 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 150 / 150
結果
AC × 3
AC × 14
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, sample_01.txt, sample_02.txt, sample_03.txt
ケース名 結果 実行時間 メモリ
random_01.txt AC 43 ms 6836 KiB
random_02.txt AC 21 ms 5284 KiB
random_03.txt AC 42 ms 6904 KiB
random_04.txt AC 10 ms 4484 KiB
random_05.txt AC 110 ms 6904 KiB
random_06.txt AC 14 ms 4192 KiB
random_07.txt AC 103 ms 6804 KiB
random_08.txt AC 4 ms 3908 KiB
random_09.txt AC 1 ms 3848 KiB
random_10.txt AC 1 ms 3724 KiB
random_11.txt AC 113 ms 6796 KiB
sample_01.txt AC 1 ms 3752 KiB
sample_02.txt AC 1 ms 3780 KiB
sample_03.txt AC 1 ms 3848 KiB