题目链接

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

  1. #include <iostream>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #include <queue>
  6. #include <stack>
  7. #include <stack>
  8. using namespace std;
  9. char s[10][200],s2[10][200];
  10. char num[7][11][6] = {
  11. "xxxxx","....x","xxxxx","xxxxx","x...x","xxxxx","xxxxx","xxxxx","xxxxx","xxxxx",".....",
  12. "x...x","....x","....x","....x","x...x","x....","x....","....x","x...x","x...x","..x..",
  13. "x...x","....x","....x","....x","x...x","x....","x....","....x","x...x","x...x","..x..",
  14. "x...x","....x","xxxxx","xxxxx","xxxxx","xxxxx","xxxxx","....x","xxxxx","xxxxx","xxxxx",
  15. "x...x","....x","x....","....x","....x","....x","x...x","....x","x...x","....x","..x..",
  16. "x...x","....x","x....","....x","....x","....x","x...x","....x","x...x","....x","..x..",
  17. "xxxxx","....x","xxxxx","xxxxx","....x","xxxxx","xxxxx","....x","xxxxx","xxxxx","....."};
  18. int f[15];
  19. void cmp(int l,int r,int x)
  20. {
  21. int i,j;
  22. for(i=0;i<=10;i++)
  23. {
  24. if(!f[i])
  25. continue;
  26. for(j=0;j<5;j++)
  27. {
  28. if(s[x][l+j]!=num[x][i][j])
  29. break;
  30. }
  31. if(j!=5)
  32. f[i] = 0;
  33. }
  34. }
  35. int read(int l,int r)
  36. {
  37. int i;
  38. for(i=0;i<=10;i++)
  39. f[i] = 1;
  40. for(i=0;i<7;i++)
  41. cmp(l,r,i);
  42. for(i=0;i<=10;i++)
  43. {
  44. if(f[i])
  45. return i;
  46. }
  47. return -1;
  48. }
  49. long long c;
  50. void show(long long x,int a)
  51. {
  52. if(x>=10)
  53. show(x/10,a);
  54. if(x!=c)
  55. printf("%s.",num[a][x%10]);
  56. else
  57. printf("%s\n",num[a][x%10]);
  58. }
  59. int main()
  60. {
  61. int i;
  62. long long a,b,n,sum;
  63. for(i=0;i<7;i++)
  64. scanf("%s",s[i]);
  65. n = strlen(s[0]);
  66. a = b = 0;
  67. sum = 0;
  68. for(i=0;i<n;i+=6)
  69. {
  70. c = read(i,i+5);
  71. if(c==10)
  72. {
  73. a = sum;
  74. sum = 0;
  75. }
  76. else
  77. {
  78. sum *= 10;
  79. sum += c;
  80. }
  81. }
  82. b = sum;
  83. c = a + b;
  84. for(i=0;i<7;i++)
  85. show(c,i);
  86. return 0;
  87. }

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. Spring.Net2.0+NHibernate4.0 +Asp.Net Mvc4 二

    6.SN.Controllers 文件夹Config(Controllers.xml) 文件夹Controllers(TestController.cs) Controllers.xml <?x ...

  2. Silver Cow Party POJ - 3268 (固定起点和固定终点的最短路)

    思路:有向图.假设在X牧场参加party,从X回家的时候,以X为起点,使用一次Dijkstra算法即可.难点在于去X参加party的最短路如何求解. 这时候我们可以反向建图,即把原来有向图的方向全部反 ...

  3. 计蒜客 Flashing Fluorescents(状压DP)

    You have nn lights, each with its own button, in a line. Pressing a light’s button will toggle that ...

  4. 洛谷P1002 过河卒 [2017年4月计划 动态规划15]

    P1002 过河卒 题目描述 棋盘上A点有一个过河卒,需要走到目标B点.卒行走的规则:可以向下.或者向右.同时在棋盘上C点有一个对方的马,该马所在的点和所有跳跃一步可达的点称为对方马的控制点.因此称之 ...

  5. LUOGU P2827 蚯蚓 (noip 2016)

    传送门 解题思路 第一眼以为是一个二叉堆,直接上优先队列60分...后来听ztz11说有单调性,新加入的蚯蚓一定比原先在的蚯蚓长度长,开三个队列,分别放原先的长度,切掉后大的那一半,切掉后小的那一半. ...

  6. Win7下IIS的安装配置与文件发布

    出于兴趣,抽空弄了一下Windows上的IIS,把过程记录下来与大家分享.高手请略过... 一.安装IIS.打开控制面板,单击“程序与功能” 二.点击左侧“打开或关闭Windows功能” 三.找到“I ...

  7. JAVA的一次编译,到处执行,你知道多少?

    版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/wangyongxia921/article/details/28117155   一.对AVA的迷茫 ...

  8. 【水滴石穿】React Native 组件之SafeAreaView

    本文转载自:https://blog.csdn.net/xiangzhihong8/article/details/80692792 SafeAreaView简介 ReactNative官方从0.50 ...

  9. ubuntu上安装字体

    # fc-list # sudo apt-get -y install fontconfig xfonts-utils # sudo cp       XXX.ttf        /usr/shar ...

  10. bash 小技巧

    CTRL-R (reverse find),按下之后敲几个字母就能在最近打过的命令里搜索.