题目链接

题解:普通的a+b才怪问题,需要绘制出来,方法有点麻烦。

#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <stack>
#include <stack> using namespace std; char s[10][200],s2[10][200];
char num[7][11][6] = {
"xxxxx","....x","xxxxx","xxxxx","x...x","xxxxx","xxxxx","xxxxx","xxxxx","xxxxx",".....",
"x...x","....x","....x","....x","x...x","x....","x....","....x","x...x","x...x","..x..",
"x...x","....x","....x","....x","x...x","x....","x....","....x","x...x","x...x","..x..",
"x...x","....x","xxxxx","xxxxx","xxxxx","xxxxx","xxxxx","....x","xxxxx","xxxxx","xxxxx",
"x...x","....x","x....","....x","....x","....x","x...x","....x","x...x","....x","..x..",
"x...x","....x","x....","....x","....x","....x","x...x","....x","x...x","....x","..x..",
"xxxxx","....x","xxxxx","xxxxx","....x","xxxxx","xxxxx","....x","xxxxx","xxxxx","....."};
int f[15]; void cmp(int l,int r,int x)
{
int i,j;
for(i=0;i<=10;i++)
{
if(!f[i])
continue;
for(j=0;j<5;j++)
{
if(s[x][l+j]!=num[x][i][j])
break;
}
if(j!=5)
f[i] = 0;
}
} int read(int l,int r)
{
int i;
for(i=0;i<=10;i++)
f[i] = 1;
for(i=0;i<7;i++)
cmp(l,r,i);
for(i=0;i<=10;i++)
{
if(f[i])
return i;
}
return -1;
} long long c; void show(long long x,int a)
{
if(x>=10)
show(x/10,a);
if(x!=c)
printf("%s.",num[a][x%10]);
else
printf("%s\n",num[a][x%10]);
} int main()
{
int i;
long long a,b,n,sum;
for(i=0;i<7;i++)
scanf("%s",s[i]);
n = strlen(s[0]);
a = b = 0;
sum = 0;
for(i=0;i<n;i+=6)
{
c = read(i,i+5);
if(c==10)
{
a = sum;
sum = 0;
}
else
{
sum *= 10;
sum += c;
}
}
b = sum;
c = a + b;
for(i=0;i<7;i++)
show(c,i);
return 0;
}

Gym - 101480A_ASCII Addition的更多相关文章

  1. CodeFoeces GYM 101466A Gaby And Addition (字典树)

    gym 101466A Gaby And Addition 题目分析 题意: 给出n个数,找任意两个数 “相加”,求这个结果的最大值和最小值,注意此处的加法为不进位加法. 思路: 由于给出的数最多有 ...

  2. 字典树变形 A - Gaby And Addition Gym - 101466A

    A - Gaby And Addition Gym - 101466A 这个题目是一个字典树的变形,还是很难想到的. 因为这题目每一位都是独立的,不会进位,这个和01字典树求最大的异或和是不是很像. ...

  3. A .Gaby And Addition (Gym - 101466A + 字典树)

    题目链接:http://codeforces.com/gym/101466/problem/A 题目: 题意: 给你n个数,重定义两个数之间的加法不进位,求这些数中两个数相加的最大值和最小值. 思路: ...

  4. Gaby And Addition Gym - 101466A (初学字典树)

    Gaby is a little baby who loves playing with numbers. Recently she has learned how to add 2 numbers ...

  5. 【贪心】【字典树】Gym - 101466A - Gaby And Addition

    题意:定义一种无进位加法运算,给你n个正整数,问你取出两个数,使得他们加起来和最大/最小是多少. 无进位加法运算,其实是一种位运算,跟最大xor那个套路类似,很容易写出对于每个数字,其对应的最优数字是 ...

  6. Codeforces Gym 100513M M. Variable Shadowing 暴力

    M. Variable Shadowing Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513/ ...

  7. Codeforces Gym 100610 Problem A. Alien Communication Masterclass 构造

    Problem A. Alien Communication Masterclass Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codefo ...

  8. Gym 100646 Problem C: LCR 模拟题

    Problem C: LCR 题目连接: http://codeforces.com/gym/100646/attachments Description LCR is a simple game f ...

  9. [LeetCode] Range Addition 范围相加

    Assume you have an array of length n initialized with all 0's and are given k update operations. Eac ...

随机推荐

  1. Python执行时间的计算方法小结

    Python执行时间的计算方法小结 首先说一下我遇到的坑,生产上遇到的问题,我调度Python脚本执行并监控这个进程,python脚本运行时间远远大于python脚本中自己统计的程序执行时间. 监控p ...

  2. 8天入门wpf—— 第四天 模板

    今天说下wpf中的模板,前面一篇中我们讲到了style,但是style所能做的仅仅是在现有控件的基础上进行修修补补,但是如果我们想彻底颠覆控件样式,那么我们就必须使用这一篇所说的模板. 老外写书都喜欢 ...

  3. jnhs-springmvc 请求组合不正确,比如请求路径出现两次

    初学springmvc 向后台传参数,结果发现,一直404 404后没有路径,说明 没有进入controller 仔细一看,请求路径不对,重复出现 页面是这样写的 页面是这样写的 原因是,请求链接和当 ...

  4. MyBatis连接Neo4j问题记录:mapper参数传递(节点标签作为参数)

    MyBatis与Neo4j的连接我在上一篇做了,这是链接:https://blog.csdn.net/qq_34233510/article/details/82496101 上一篇中UserMapp ...

  5. 2019.10.25 csp-s模拟测试86 反思总结

    继续存档 早上来补了一下昨天的题,不过肯定这两天的没法完全补起来 T1: 经典思路:关于位运算的题讨论每一位的贡献 #include<iostream> #include<cstdi ...

  6. Leetcode15.3Sum三数之和

    给定一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,使得 a + b + c = 0 ?找出所有满足条件且不重复的三元组. 注意:答案中不可以包含重复的三元组. ...

  7. Leetcode91.Decode Ways解码方法

    一条包含字母 A-Z 的消息通过以下方式进行了编码: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 给定一个只包含数字的非空字符串,请计算解码方法的总数. 示例 1 ...

  8. 【cml】wosi-demo

    推荐一个cml项目,https://github.com/Bowen7/wosi-demo 呃呃,运行了项目只能够说开发者好牛逼,数据处理很厉害, 这个是最后的结果,然后要进行效果查看,估计你得等明天 ...

  9. pip 异常问题

    场景:安装的python版本为3.6.4 在使用pip命令时,出现错误:Did not provide a command 如下图所示: 解决办法:pip带上后缀.exe 为什么会出现这种情况? 主要 ...

  10. golang数组 排序和查找

    package main import "fmt" func BubbleSort(arr *[5]int){ fmt.Println("排序前arr=",(* ...