目前已AC:  2

1040.Airline Company(构造)

题目要求与每个顶点相连的所有边编号最大公约数为1,其实只要其中的两条边编号互质,所有边编号的最大公约数一定为1。我们知道相邻的数字一定互质,那么只要与一个顶点相连的所有边中有两条编号相邻,这个顶点就可以符合条件。DFS序列,对边进行编号刚好可以构造出满足要求的解,并且无解的情况是不存在的。

# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iostream>
# include <vector>
# include <queue>
# include <stack>
# include <map>
# include <set>
# include <cmath>
# include <algorithm>
using namespace std;
# define lowbit(x) ((x)&(-x))
# define pi acos(-1.0)
# define eps 1e-
# define MOD
# define INF
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(int i=a; i<=n; ++i)
# define FO(i,a,n) for(int i=a; i<n; ++i)
# define bug puts("H");
# define lch p<<,l,mid
# define rch p<<|,mid+,r
# define mp make_pair
# define pb push_back
typedef pair<int,int> PII;
typedef vector<int> VI;
# pragma comment(linker, "/STACK:1024000000,1024000000")
typedef long long LL;
int Scan() {
    , flag=;
    char ch;
    ;
    ';
    +(ch-');
    return flag?-res:res;
}
void Out(int a) {
    ) {putchar('-'); a=-a;}
    ) Out(a/);
    putchar(a%+');
}
;
//Code begin...

][], dfn[][], node[], n, tot;
vector<PII>edge;

void dfs(int x)
{
    node[x]=;
    FOR(i,,n) ) dfn[x][i]=dfn[i][x]=++tot, dfs(i);
}
int main ()
{
    int m, u, v;
    scanf("%d%d",&n,&m);
    ;
    FOR(i,,n) ) dfs(i);
    puts("YES");
    ; i<edge.size(); ++i) printf("%d ",dfn[edge[i].first][edge[i].second]);
    putchar('\n');
    ;
}

1075.Thread in a Space(高中几何)

# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iostream>
# include <vector>
# include <queue>
# include <stack>
# include <map>
# include <set>
# include <cmath>
# include <algorithm>
using namespace std;
# define lowbit(x) ((x)&(-x))
# define pi acos(-1.0)
# define eps 1e-
# define MOD
# define INF
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(int i=a; i<=n; ++i)
# define FO(i,a,n) for(int i=a; i<n; ++i)
# define bug puts("H");
# define lch p<<,l,mid
# define rch p<<|,mid+,r
# define mp make_pair
# define pb push_back
typedef pair<int,int> PII;
typedef vector<int> VI;
# pragma comment(linker, "/STACK:1024000000,1024000000")
typedef long long LL;
int Scan() {
    , flag=;
    char ch;
    ;
    ';
    +(ch-');
    return flag?-res:res;
}
void Out(int a) {
    ) {putchar('-'); a=-a;}
    ) Out(a/);
    putchar(a%+');
}
;
//Code begin...

template<class T>
T sqr(T x)
{
    return x*x;
}

int main()
{
    double xa, ya, za, xb, yb, zb, xc, yc, zc, r;
    scanf("%lf%lf%lf", &xa, &ya, &za);
    scanf("%lf%lf%lf", &xb, &yb, &zb);
    scanf("%lf%lf%lf", &xc, &yc, &zc);
    scanf("%lf", &r);
    double ab=sqrt(sqr(xa-xb) + sqr(ya-yb) + sqr(za-zb));
    double ac=sqrt(sqr(xa-xc) + sqr(ya-yc) + sqr(za-zc));
    double bc=sqrt(sqr(xb-xc) + sqr(yb-yc) + sqr(zb-zc));
    *ac*bc));
    double a=acos(r/ac);
    double b=acos(r/bc);
    if(a+b>=c) printf("%.2lf\n", ab);
    else printf("%.2lf\n", (c-a-b)*r + sqrt(sqr(ac) - sqr(r)) + sqrt(sqr(bc) - sqr(r)));
    ;
}

Ural Vol1(dif>=900)的更多相关文章

  1. ural 1269. Obscene Words Filter

    1269. Obscene Words Filter Time limit: 0.5 secondMemory limit: 8 MB There is a problem to check mess ...

  2. URAL 1145—— Rope in the Labyrinth——————【求树的直径】

    Rope in the Labyrinth Time Limit:500MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64 ...

  3. ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'

    凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...

  4. ural 1208 Legendary Teams Contest

    题意描述:给定K支队伍,每队三个队员,不同队伍之间队员可能部分重复,输出这些队员同时能够组成多少完整的队伍: DFS,利用DFS深度优先搜索,如果该队所有队员都没有被访问过,那么将该队计入结果,再去选 ...

  5. 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome

    题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...

  6. ural 2071. Juice Cocktails

    2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...

  7. ural 2073. Log Files

    2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...

  8. ural 2070. Interesting Numbers

    2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...

  9. ural 2069. Hard Rock

    2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock ...

随机推荐

  1. 一个不错的PHP文件页面缓存类

    在php中缓存分类数据库缓存,文件缓存和内存缓存,下面我来给各位同学详细介绍PHP文件缓存类实现代码,有需要了解的朋友可参考. 页面缓存类 <?php    /*    * 缓存类    cac ...

  2. VIM继承C语言(转)

    在下面的基础上加上了astyle sh.c --style=kr --indent=spaces --indent-cases --pad-header --pad-oper --unpad-pare ...

  3. cocos2d-x 那些常犯的错误

    Label::_label; if(_label==NULL){ //初始化_label的代码 } //指针默认值不等于NULL,需要赋初始值Label::_label=NULL; string st ...

  4. HDU - 1205 I NEED A OFFER!

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1203 题意: 该题要求得到一份offer的最大概率,在例子中的0.44 = 1-(1-0.2)*(1- ...

  5. Chapter 1 First Sight——14

    I parked in front of the first building, which had a small sign over the door reading front office. ...

  6. win10系统安装oracle11g时遇到INS-13001环境不满足最低要求

    升级win10系统之后,需要重新安装Oracle,因为在安装Oralce11g时,使用64位的会出现各种不兼容问题,我每次安装都是使用32位的数据库. 在安装时点击setup.exe之后,出现了:[I ...

  7. 提升html5的性能体验系列之一避免切页白屏

    窗体切换白屏的现实问题 HTML5的性能比原生差很多,比如切页时白屏.列表滚动不流畅.下拉刷新和上拉翻页卡顿.在低端Android手机上,很多原生App常用的功能和体验效果都很难使用HTML5技术模拟 ...

  8. C#编写Windows服务程序图文教程

    安装服务程序C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe  要安装的服务程序路径(如F:\***.exe)卸载服务程序C: ...

  9. android脚步---使用framelayout实现霓虹灯效果

    轮换帧布局中7个TextView的背景颜色,会出现上面颜色渐变不断变换. 首先在main.xml文件中进行布局 总体布局为framelayout 中间有7个Textview,代表7种不同的颜色,可以看 ...

  10. 2304: Lights Out(枚举)

    枚举第一行所有可能的的情况 #include<iostream> #include<cstdio> #include<cstring> #include<al ...