题目链接

题解:普通的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. Django项目:CRM(客户关系管理系统)--54--45PerfectCRM实现账号快速重置密码

    # gbacc_ajax_urls.py # ————————42PerfectCRM实现AJAX全局账号注册———————— from django.conf.urls import url fro ...

  2. 前端(Node.js)(1)-- 初识Node.js

    1.认识 Node.js 诞生.发展.应用现状.生态圈等方面 1.1. 2008年 RyanDahl的目标是创建一个易扩展.适用于现代Web应用通信的服务器平台 1.2.国内外的应用情况 Linked ...

  3. Java 基本数据类型 相互转换

    int -> String String s=String.valueOf(12345); String -> int int i=Integer.parseInt("123&q ...

  4. Java问题解读系列之String相关---String、StringBuffer、StringBuilder的区别

    今天的题目是String.StringBuffer和StringBuilder的区别: 首先还是去官方的API看看对这三种类型的介绍吧,Go...... 一.继承类和实现接口情况 1.String类 ...

  5. JSP-Cookie和Session

    1 会话技术简介 1.1 存储客户端状态 1.2 会话技术 2 Cookie技术 2.1 Cookie技术的购物 2.2 服务器端向客户端发Cookie //1.创建cookie对象 Cookie c ...

  6. JSP-http和tomcat

    一 Http 1.1 javaweb概述 1.2 http协议的概述 1.什么是Http协议 HTTP,超文本传输协议(HyperText Transfer Protocol)是互联网上应用最为广泛的 ...

  7. Leetcode19.Remove Nth Node From End of List删除链表的倒数第N个节点

    给定一个链表,删除链表的倒数第 n 个节点,并且返回链表的头结点. 示例: 给定一个链表: 1->2->3->4->5, 和 n = 2. 当删除了倒数第二个节点后,链表变为 ...

  8. Leetcode606.Construct String from Binary Tree根据二叉树创建字符串

    你需要采用前序遍历的方式,将一个二叉树转换成一个由括号和整数组成的字符串. 空节点则用一对空括号 "()" 表示.而且你需要省略所有不影响字符串与原始二叉树之间的一对一映射关系的空 ...

  9. golang之if

    1.if语句 (1)if (2)if else (3)if esle ...else

  10. visual studio code 调试reactjs

    1.首先到visual studio code官网下载ide. 2.打开visual studio code,点击右侧菜单条的小图标 找到[Debugger for Chrome],并安装 3.打开c ...