Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:没过的试一试c++,真是服了 c++就过了 g++就过不了

Posted by Cerdore at 2017-09-18 20:32:04 on Problem 2502
In Reply To:没过的试一试c++,真是服了 c++就过了 g++就过不了 Posted by:nka_kun at 2017-08-24 18:20:36
> #include<cstdio>
> #include<iostream>
> #include<algorithm>
> #include<queue>
> #include<stack>
> #include<cstring>
> #include<string>
> #include<vector>
> #include<cmath>
> #include<map>
> using namespace std;
> typedef long long ll;
> #define mem(a,b) memset(a,b,sizeof(a))
> const int maxn = 1e5+5;
> const int ff = 0x3f3f3f3f;
> int sx,sy,ex,ey;
> 
> long long temp[205][2];
> double mp[205][205];
> double dis[205];
> int vis[205];
> int cnt = 2;
> 
> void solve()
> {
>     for(int i = 1;i<= cnt;i++)
>         dis[i] = mp[1][i];
>     vis[1] = 0;
>     dis[1] = 0;
>     int num = 1;
>     while(num<= cnt)
>     {
>         double min_d = 9999999999999;
>         int min_v;
>         for(int i = 1;i<= cnt;i++)
>         {
>             if(!vis[i]&&dis[i]< min_d)
>                 min_d = dis[i],min_v = i;
>         }
>         vis[min_v] = 1;
>         num++;
>         if(min_v == 2)
>             break;
>         for(int i = 1;i<= cnt;i++)
>         {
>             if(!vis[i]&&min_d+mp[min_v][i]< dis[i])
>             {
>                 dis[i] = min_d+mp[min_v][i];
>             }
>         }
>     }
>     double ans = dis[2]*60;
>     printf("%.0lf\n",ans);
> 
> }
> 
> int main()
> {
>     mem(vis,0);
>     scanf("%I64d %I64d %I64d %I64d",&temp[1][0],&temp[1][1],&temp[2][0],&temp[2][1]);
>     int t[202][2];
>     ll x,y;
>     int l,r;
>     int flag = 0;
>     while(scanf("%I64d %I64d",&x,&y)!= EOF)
>     {
>         if(x == -1&&y == -1)
>         {
>             for(int i = l;i< r;i++)
>             {
>                 for(int j = i+1;j<= r;j++)
>                 {
>                     double sum = 0;
>                     for(int k = i;k< j;k++)
>                         sum+= sqrt((double)(temp[k][0]-temp[k+1][0])*(double)(temp[k][0]-temp[k+1][0])+(double)(temp[k][1]-temp[k+1][1])*(double)(temp[k][1]-temp[k+1][1]))/(40000*1.0);
>                     mp[i][j] = sum;
>                     mp[j][i] = sum;
>                 }
>             }
>             flag = 0;
>             continue;
>         }
>         temp[++cnt][0] = x;
>         temp[cnt][1] = y;
>         if(flag == 0)
>         {
>             flag = 1;
>             l = cnt;
>         }
>         r = cnt;
>     }
>     for(int i = 1;i< cnt;i++)
>     {
>         for(int j = i+1;j<= cnt;j++)
>         {
>             if(mp[i][j]!= 0)
>             {
>                 mp[i][j] = min(mp[i][j],sqrt((double)(temp[i][0]-temp[j][0])*(double)(temp[i][0]-temp[j][0])+(double)(temp[i][1]-temp[j][1])*(double)(temp[i][1]-temp[j][1]))/(10000*1.0));
>                 mp[j][i] = mp[i][j];
>                 continue;
>             }
>             mp[i][j] = sqrt((double)(temp[i][0]-temp[j][0])*(double)(temp[i][0]-temp[j][0])+(double)(temp[i][1]-temp[j][1])*(double)(temp[i][1]-temp[j][1]))/(10000*1.0);
>             mp[j][i] = mp[i][j];
>         }
>     }
>     solve();
> 
>     return 0;
> }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator