//H
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>

using namespace std;

char s1[1010],s2[1010],ans[1010];

void AandB()
{
    stack<int>s;
    int n = strlen(s1), m = strlen(s2);
    int cnt1 = n-1, cnt2 = m-1;
    int a,b,last=0;
    while(cnt1>=0 || cnt2>=0)
    {
        if(cnt1 != -1)
        {
            a = s1[cnt1--] - '0';
        }
        else
        {
            a = 0;
        }
        if(cnt2 != -1)
        {
            b = s2[cnt2--] - '0';
        }
        else
        {
            b = 0;
        }
        int z = a + b + last;
        s.push(z%10);
        last = z / 10;
    }
    int cnt = 0;
    while(!s.empty())
    {
        ans[cnt++] = s.top() + '0';
        s.pop();
    }
    ans[cnt] = 0;
    return ;
}

int main()
{
    int t;
    scanf("%d",&t);
    for(int i=1; i<=t; i++)
    {
        getchar();
        scanf("%s %s",s1,s2);
        AandB();
        if(i!=1) printf("\n");
        printf("Case %d:\n%s + %s = %s\n",i,s1,s2,ans);
    }
    return 0;
} 
//A
#include<bits/stdc++.h>

using namespace std;

int f[1000010];

int main()
{
    f[0] = 1; f[1] = 2;
    for(int i=2; i<1000010; i++)
    {
        int x = f[i-1] + f[i-2];
        f[i] = x % 3;
    }
    int n;
    while(~scanf("%d",&n))
    {
        if(!f[n]) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}
//D
#include<bits/stdc++.h>

using namespace std;

int main()
{
    long long a,b,z,ans,y,x;
    int t;
    scanf("%d",&t);
    for(int i=1; i<=t; i++)
    {
        scanf("%lld %lld",&a,&b);
        z = b - a + 1;
        ans = z / 3 * 2;
        y = a % 3;
        x = z % 3;
        if(y == 1 && x == 2)
        {
            ans++;
        }
        else if(y == 0 && x >= 1)
        {
            ans++;
        }
        else if(y == 2)
        {
            ans += x;
        }
        printf("Case %d: %lld\n",i,ans);
    }
    return 0;
}
//D(二)
#include<bits/stdc++.h>

using namespace std;

int main()
{
    long long a,b,ans,y,x;
    int t;
    scanf("%d",&t);
    for(int i=1; i<=t; i++)
    {
        scanf("%lld %lld",&a,&b);
        a--;
        x = a / 3 * 2 + (a%3==2);
        y = b / 3 * 2 + (b%3==2);
        ans = y - x;
        printf("Case %d: %lld\n",i,ans);
    }
    return 0;
}
//I
#include<bits/stdc++.h>

using namespace std;

int num[100010];

int main()
{
    int n,t,maxsum,thissum,maxl,thisl,r,i;
    scanf("%d",&t);
    for(int j=1; j<=t; j++)
    {
        scanf("%d",&n);
        thissum = 0;
        r = maxl = thisl = 1;
        for(i=1; i<=n; i++)
        {
            scanf("%d",&num[i]);
            if(i == 1) maxsum = num[i];
            thissum += num[i];
            if(thissum > maxsum)
            {
                maxsum = thissum;
                maxl = thisl;
                r = i;
            }
            if(thissum < 0)
            {
                thissum = 0;
                thisl = i + 1;
            }
        }
        if(j != 1) printf("\n");
        printf("Case %d:\n%d %d %d\n",j,maxsum,maxl,r);
    }
    return 0;
}
//B
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<cstring>
#include<algorithm>

using namespace std;

struct node
{
    int x,y,z;
};
int u,v,w;
char dun[31][31][31];
int book[31][31][31];
queue<node>q;

void Insert(int a,int b,int c,int l)
{
    if(dun[a][b][c] == '#' || book[a][b][c] != 0) return ;
    node t = {a,b,c};
    q.push(t);
    book[a][b][c] = l + 1;
}

bool InDun(int x,int y,int z,int l,int r,int c)
{
    if(x<l && x>=0 && y<r && y>=0 && z<c && z>=0) return 1;
    else return 0;
}

bool bfs(int l,int r,int c)
{
    while(!q.empty())
    {
        node t = q.front();
        q.pop();
        if(dun[t.x][t.y][t.z] == 'E')
        {
            u = t.x; v = t.y; w = t.z;
            return 1;
        }
        if(InDun(t.x+1,t.y,t.z,l,r,c)) Insert(t.x+1,t.y,t.z,book[t.x][t.y][t.z]);
        if(InDun(t.x-1,t.y,t.z,l,r,c)) Insert(t.x-1,t.y,t.z,book[t.x][t.y][t.z]);
        if(InDun(t.x,t.y+1,t.z,l,r,c)) Insert(t.x,t.y+1,t.z,book[t.x][t.y][t.z]);
        if(InDun(t.x,t.y-1,t.z,l,r,c)) Insert(t.x,t.y-1,t.z,book[t.x][t.y][t.z]);
        if(InDun(t.x,t.y,t.z+1,l,r,c)) Insert(t.x,t.y,t.z+1,book[t.x][t.y][t.z]);
        if(InDun(t.x,t.y,t.z-1,l,r,c)) Insert(t.x,t.y,t.z-1,book[t.x][t.y][t.z]);
    }
    return 0;
}

int main()
{
    int l,r,c;
    node qi;
    while(~scanf("%d %d %d",&l,&r,&c))
    {
        if(l==0 && r==0 && c==0) break;
        getchar();
        memset(book,0,sizeof(book));
        while(!q.empty()) q.pop();
        for(int i=0; i<l; i++)
        {
            for(int j=0; j<r; j++)
            {
                for(int k=0; k<c; k++)
                {
                    scanf("%c",&dun[i][j][k]);
                    if(dun[i][j][k] == 'S')
                    {
                        qi.x = i; qi.y = j; qi.z = k;
                        book[i][j][k] = 1;
                    }
                }
                getchar();
            }
            getchar();
        }
        q.push(qi);
        if(bfs(l,r,c)) printf("Escaped in %d minute(s).\n",book[u][v][w]-1);
        else printf("Trapped!\n");
    }
    return 0;
}

2.4测试赛AC代码临时保存的更多相关文章

  1. 2.2测试赛AC代码临时保存

    //A #include<cstdio> #include<cstdlib> #include<algorithm> #include<cstring> ...

  2. VJ数论专题AC代码临时保存

    //A #include<bits/stdc++.h> using namespace std; bool vis[1000010]; void Get_Prime() { int n = ...

  3. 【南阳OJ分类之语言入门】80题题目+AC代码汇总

    小技巧:本文之前由csdn自动生成了一个目录,不必下拉一个一个去找,可通过目录标题直接定位. 本文转载自本人的csdn博客,复制过来的,排版就不弄了,欢迎转载. 声明: 题目部分皆为南阳OJ题目. 代 ...

  4. python爬虫学习(7) —— 爬取你的AC代码

    上一篇文章中,我们介绍了python爬虫利器--requests,并且拿HDU做了小测试. 这篇文章,我们来爬取一下自己AC的代码. 1 确定ac代码对应的页面 如下图所示,我们一般情况可以通过该顺序 ...

  5. 2018.12.21 浪在ACM 集训队第十次测试赛

     浪在ACM 集训队第十次测试赛 A Diverse Substring B Vasya and Books C Birthday D LCM A 传送门 题解 B 传送门 题解: 这道题,就比较简单 ...

  6. nowcoder(牛客网)OI测试赛3 解题报告

    昨天因为胡搞了一会儿社团的事情,所以错过(逃过)了nowcoder的测试赛..... 以上,听说还是普及组难度qwq,而且还有很多大佬AK(然而我这么蒻肯定还是觉得有点难度的吧qwq) 不过我还是日常 ...

  7. 牛客OI赛制测试赛2(0906)

    牛客OI赛制测试赛2(0906) A :无序组数 题目描述 给出一个二元组(A,B) 求出无序二元组(a,b) 使得(a|A,b|B)的组数 无序意思就是(a,b)和(b,a) 算一组. 输入描述: ...

  8. 2018.12.14 浪在ACM 集训队第九次测试赛

    浪在ACM 集训队第九次测试赛 B Battleship E Masha and two friends B 传送门 题意: 战船上有占地n*n的房间cells[][],只由当cells[i][j]= ...

  9. HDU2449 Gauss Elimination 高斯消元 高精度 (C++ AC代码)

    原文链接https://www.cnblogs.com/zhouzhendong/p/HDU2449.html 题目传送门 - HDU2449 题意 高精度高斯消元. 输入 $n$ 个 $n$ 元方程 ...

随机推荐

  1. javaSE学习笔记(17)---锁

    javaSE学习笔记(17)---锁 Java提供了种类丰富的锁,每种锁因其特性的不同,在适当的场景下能够展现出非常高的效率.本文旨在对锁相关源码(本文中的源码来自JDK 8).使用场景进行举例,为读 ...

  2. 树莓派搭载CentOS7系统初始配置

    系统属性: 树莓派型号:3b SD:32GB 系统:CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-1908-sda.raw 开机配置: 连接树莓派: 配件 ...

  3. 《手把手教你构建自己的 Linux 系统》学习笔记(10)

    目录 /etc/fstab 文件的作用是什么? Linux 内核的图形化启动是怎么回事? Linux 系统中的文件名是否以大小写来进行区别? 「GRUB 中无法找到硬盘」怎么解决? 「GRUB 及配置 ...

  4. go语言开发工具sublime text3 + gosublime配置

    开始go语言开发时,网上google了下go的开发工具,大都推荐 sublime text3+gosublime.但是实际操作中gosublime不能直接安装,需要自己手动安装.将自己的安装过程整理一 ...

  5. jQuery---委托事件原理

    jQuery事件发展历程 事件发展历程:从简单事件,到bind,到委托事件,到on事件绑定 //简单事件,给自己注册的事件 $("div").click(function () { ...

  6. 获取http://XX.XX.XX.XX :XXXX/QuestionResult.aspx?method=接口返回值

    private string GetWeather(string strRegisterNo) { string getWeatherUrl = "http://XX.XX.XX.XX :X ...

  7. TCP 协议快被淘汰了,UDP 协议才是新世代的未来?

    TCP 协议可以说是今天互联网的基石,作为可靠的传输协议,在今天几乎所有的数据都会通过 TCP 协议传输,然而 TCP 在设计之初没有考虑到现今复杂的网络环境,当你在地铁上或者火车上被断断续续的网络折 ...

  8. Secondary NameNode:它究竟有什么作用?

    前言 最近刚接触Hadoop, 一直没有弄明白NameNode和Secondary NameNode的区别和关系.很多人都认为,Secondary NameNode是NameNode的备份,是为了防止 ...

  9. Oracle中表与包体用户没有操作权限问题

    一.表1.在stg用户下查看table_name 表是否存在select * from table_name 2 在表所在用户执行(授权)grant select,update on table_na ...

  10. Linux shell 只删除目录下所有(不知道文件名字)文件,只删除文件夹

    #!/bin/sh RM="rm -rf" function delete_all_dir() { for i in `ls` do if [ -d $i ];then $RM $ ...