#include <iostream>
 #include <cstring>
 #include <cstdio>
 #include <algorithm>
 #include <cmath>
 using namespace std;
  + ;
 struct points
 {
     double x,y;
 };
 points point[MAX];
 double d[MAX][MAX];
 double dist(int a, int b)
 {
     return sqrt( (point[a].x - point[b].x) * (point[a].x - point[b].x) + (point[a].y - point[b].y) * (point[a].y - point[b].y));
 }
 int main()
 {
     int n;
     while(scanf("%d", &n) != EOF)
     {
         ; i <= n; i++)
             scanf("%lf%lf", &point[i].x, &point[i].y);

         ; i < n - ; i++)
             d[n - ][i] = dist(n - , n) + dist(i, n);

         ; i > ; i--)
         {
             ; j < i; j++)
             {
                 ][j] + dist(i, i + ) - d[i + ][i] - dist(j, i + ) > 0.00001)
                     d[i][j] = d[i + ][j] + dist(i, i + );
                 else
                     d[i][j] = d[i + ][i] + dist(j, i + );
             }
         }
         printf(][] + dist(,));
     }

     ;
 }

UVA1347紫书dp

zoj1163http://blog.csdn.net/cherry_sun/article/details/6245208

 #include <iostream>
 #include <cstring>
 #include <algorithm>
 #include <map>
 #include <cstdio>
 using namespace std;
 map<string,int> color;
 ][],cnt[],sum[];
  + ];
 int main()
 {
     int n,m;
     while(scanf("%d%d", &n, &m) != EOF)
     {
          && m == )
             break;
         ];
         ; i <= n; i++)
         {
             scanf("%s", temp);
             color[temp] = i;
         }
         int x;

         memset(cnt, , sizeof(cnt));
         memset(sum, , sizeof(sum));
         memset(ans, , sizeof(ans));

         ; i <= m; i++)
         {
             scanf("%d%s",&x, temp);
             cloth[ color[temp] ][ cnt[ color[temp] ]++ ] = x;
         }
         ; i <= n; i++)
         {
             ; j < cnt[i]; j++)
             {
                 sum[i] += cloth[i][j];
             }
         }

         ;
         ; i <= n; i++)
         {
             ;
             ; j < cnt[i]; j++)
             {
                 for(int k = v; k >= cloth[i][j]; k--)
                 {
                     ans[k] = max(ans[k], ans[k - cloth[i][j]] + cloth[i][j]);
                 }
             }
             all += sum[i] - ans[v];
         }
         printf("%d\n",all);
     }

     ;
 }

UVA类似于8皇后问题

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
;
int g[MAX][MAX],vis[MAX][MAX*MAX];
int n,m,ans,t;
void dfs(int x,int cnt)
{
    ;
    for(int i = x; i < n; i++)
    {
        ; j < m; j++)
        {
            if(g[i][j])
            {
                ][j] ==  && vis[][i + j] ==  && vis[][i - j + t] == )
                {
                    flag = ;
                    break;
                }
            }
        }
        )
        {
            break;
        }
    }
    )
    {
        ans =min(ans,cnt);
        return ;
    }
    ; i < m; i++)
    {
        if(g[x][i])
        {
            ][i] ==  && vis[][x + i] ==  && vis[][x - i + t] == )
            {
                vis[][i] = vis[][x + i] = vis[][x - i + t] = ;
                dfs(x + , cnt + );
                vis[][i] = vis[][x + i] = vis[][x - i + t] = ;
            }
        }
    }
}
int main()
{
    ;
    while(scanf("%d", &n) != EOF)
    {
        )
            break;
        scanf("%d", &m);
        t = max(n,m);
        getchar();
        memset(vis,,sizeof(vis));
        memset(g,,sizeof(g));
        char ch;
        ; i < n; i++)
        {
            ; j < m; j++)
            {
                scanf("%c",&ch);
                if(ch == 'X')
                    g[i][j] = ;
            }
            getchar();
        }

        ans = ;
        dfs(,);
        printf("Case %d: %d\n",num++,ans);
    }
    ;
}

POJ 3026 Borg Maze

http://poj.org/problem?id=3026

 #include <iostream>
 #include <cstdio>
 #include <algorithm>
 #include <queue>
 #include <cstring>
 using namespace std;
 typedef pair<int,int> P;
 ;
 ][];
 ][],vis[][],dis[][],edge[][];
 int t,row,col,num;
 ][]={{,},{,},{,-},{-,} };
 void bfs(int x,int y)
 {
     queue<P> q;
     P point;
     point.first = x;
     point.second = y;
     memset(vis,,sizeof(vis));
     memset(dis,,sizeof(dis));
     vis[x][y] = ;
     q.push(point);
     while(q.size())
     {
         P temp;
         temp = q.front();
         q.pop();
         if( node[temp.first][temp.second] )
         {
             // cout<<node[x][y] <<" "<<node[point.first][point.second]<<endl;
             edge[ node[x][y] ][ node[temp.first][temp.second] ] = dis[temp.first][temp.second];
         }
         ; i < ; i++)
         {
             ];
             ];
              && fy >=  && fx < row && fy < col)
             {
                  && g[fx][fy] != '#')
                 {
                     dis[fx][fy] = dis[temp.first][temp.second] + ;
                     vis[fx][fy] = ;
                     point.first = fx;
                     point.second = fy;
                     q.push(point);
                 }
             }
         }
     }
 }
 void prime()
 {
     ];
     ];
     ; i < num; i++)
     {
         v[i] = false;
     }
     ; i < num; i++)
         s[i] = edge[][i];
     v[] = true;
     ;
     ; i < num; i++)
     {
         int pos, minn = INF;
         ; j < num; j++)
         {
             if(v[j] == false && s[j] < minn)
             {
                 minn = s[j];
                 pos = j;
             }
         }
         sum += minn;
         v[pos] = true;
         ; j < num; j++)
         {
             if(s[j] > edge[pos][j])
                 s[j] = edge[pos][j];
         }
     }
     printf("%d\n",sum);
 }
 int main()
 {
     scanf("%d", &t);
     while(t--)
     {
         scanf("%d%d", &col,&row);
         getchar();
         num = ;
         memset(node,,sizeof(node));
         memset(edge,,sizeof(edge));
         ; i < row; i ++)
         {
             ; j < col; j++)
             {
                 scanf("%c", &g[i][j]);
                 if(g[i][j] == 'A' || g[i][j] == 'S')
                     node[i][j] = num++;
             }
             getchar();
         }
         ; i < row; i++)
         {
             ; j < col; j++)
                 if(node[i][j])
                 bfs(i,j);
         }
         prime();
     }
     ;
 }

POJ2253

#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;
 + ;
 << ;
struct Node
{
    int x,y;
};
Node point[MAX];
int N;
double path[MAX][MAX],dist[MAX],ans;
int vis[MAX];
void prime()
{
    memset(vis,,sizeof(vis));
    ; i <= N; i++)
    dist[i] = path[][i];
    vis[] = ;
    dist[] = ;
    ;
    ; i < N; i++)
    {
        double minn = INF;
        ; j <= N; j++)
        {
             && dist[j] < minn)
            {
                minn = dist[j];
                pos = j;
            }
        }
        vis[pos] = ;
        dist[pos] = minn;
        )
            return;
        if(ans < minn)
            ans = minn;
        ; j <= N; j++)
        {
            )
                dist[j] = dist[pos] + path[pos][j];
        }
    }
}
int main()
{
    ;
    while(scanf("%d", &N) != EOF && N)
    {
        ; i <= N; i++)
        {
            scanf("%d%d",&point[i].x,&point[i].y);
        }
        ; i <= N; i++)
        {
            ; j <= N; j++)
            {
                double x = point[i].x - point[j].x;
                double y = point[i].y - point[j].y;
                path[i][j] = sqrt(x * x + y * y);
            }
        }
        ans = ;
        prime();
        printf("Scenario #%d\n",++t);
        if(ans)
            printf("Frog Distance = %0.3lf\n",ans);
        else
             printf(][]);
        printf("\n");
    }
    ;
}

WA题集的更多相关文章

  1. 数位dp题集

    题集见大佬博客 不要62 入门题,检验刚才自己有没有看懂 注意一些细节. 的确挺套路的 #include<bits/stdc++.h> #define REP(i, a, b) for(r ...

  2. ACM题集以及各种总结大全!

    ACM题集以及各种总结大全! 虽然退役了,但是整理一下,供小弟小妹们以后切题方便一些,但由于近来考试太多,顾退役总结延迟一段时间再写!先写一下各种分类和题集,欢迎各位大牛路过指正. 一.ACM入门 关 ...

  3. 全国各大 oj 分类题集...

    各种题集从易到难刷到手软  你准备好了吗? 准备剁手吧

  4. ACM题集以及各种总结大全(转)

    ACM题集以及各种总结大全! 虽然退役了,但是整理一下,供小弟小妹们以后切题方便一些,但由于近来考试太多,顾退役总结延迟一段时间再写!先写一下各种分类和题集,欢迎各位大牛路过指正. 一.ACM入门 关 ...

  5. 组合数取模&&Lucas定理题集

    题集链接: https://cn.vjudge.net/contest/231988 解题之前请先了解组合数取模和Lucas定理 A : FZU-2020  输出组合数C(n, m) mod p (1 ...

  6. Bug是一种财富-------研发同学的错题集、测试同学的遗漏用例集

    此文已由作者王晓明授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 各位看官,可能看到标题的你一定认为这是一篇涉嫌"炒作"的文章,亦或是为了吸引眼球而起的标 ...

  7. 二级C语言题集

    时间:2015-5-13 18:01 在131题之后是按考点分类的题集,有需要的朋友可以看一下 ---------------------------------------------------- ...

  8. 中南大学2019年ACM寒假集训前期训练题集(基础题)

    先写一部分,持续到更新完. A: 寒衣调 Description 男从戎,女守家.一夜,狼烟四起,男战死沙场.从此一道黄泉,两地离别.最后,女终于在等待中老去逝去.逝去的最后是换尽一生等到的相逢和团圆 ...

  9. 【转】并查集&MST题集

    转自:http://blog.csdn.net/shahdza/article/details/7779230 [HDU]1213 How Many Tables 基础并查集★1272 小希的迷宫 基 ...

随机推荐

  1. 转载:android自定义view实战(温度控制表)!

    效果图 package cn.ljuns.temperature.view; import com.example.mvp.R; import android.content.Context;impo ...

  2. VMware中CPU分配不合理以及License限制引起的SQL Scheduler不能用于查询处理

    有一台SQL Server(SQL Server 2014 标准版)服务器中的scheduler_count与cpu_count不一致,如下截图所示: SELECT  cpu_count ,      ...

  3. VS2010以及vs10sp1安装问题

    进公司第一天搭建开发环境,由于系统版本有点低,安装遇到各种问题,在此总结一下,以备日后有用. 问题描述 Windows server 2003 安装VS2010时,安装到Microsoft.NET F ...

  4. java在类定义时对hashset的便捷初始化方法

    有时候我们在类成员定义时,当这个类成员类型为 HashSet时,我们可以不方便调用 add函数进行初始化,所以可以采用下面的便捷方式来进行初始化 public class MyTest{ final ...

  5. css实现页面元素居中

    水平居中 对于已知宽度的块级元素实现水平居中只需要设置 margin-left:auto; margin-right:auto; 对于多个块级元素实现水平居中只需要设置 //1 父类{ text-al ...

  6. LK产品如何提高通信速率

    之前做LK,由于采用自定义协议,485通信.为了避免通信撞车,采用主控轮询.从机应答的通信方式. 当设备规模扩大,需要轮询的子设备和参数变多时,轮询周期就会加长,人机交互时,系统反应缓慢. 分析主控轮 ...

  7. 第9章 Shell基础(2)_Bash基本功能

    3. Bash的基本功能 3.1 历史命令与命令补全 (1)历史命令:#history [选项] [历史命令保存文件] ①选项:-c:清空历史命令: -w:把缓存中的历史命令写入文件~/.bash_h ...

  8. kettle中含有参数传递的定时任务

    (1)新建一个作业(新建->作业),并在控制面板右键: (2)设置一个命令参数: (3)把作业的参数传递给转换: (4)在转换中右键设置转换属性: (5)接收作业中设置的传递参数: (6)参数的 ...

  9. jdbc java数据库连接 11)中大文本类型的处理

    1. Jdbc中大文本类型的处理 Oracle中大文本数据类型, Clob    长文本类型   (MySQL中不支持,使用的是text) Blob    二进制类型 MySQL数据库, Text   ...

  10. 做了一个sublime text插件

    做了一个sublime text插件,可以方便地查看C++/python的调用图.插件的演示视频在这里: http://list.youku.com/albumlist/show?id=2820226 ...