【题目简述】:两个四位数,假设后一个数中的某个数与前一个相应的数的位置和值都相等。则统计数目由几个这种数。记为count1吧。

假设后一个数中的某个数与前一个数的数值相等,但位置不同。

此时这种数的个数记为count2。

写成*A*B,即count1 A count2 B。

【分析】:题目的简述即分析。

//740K 0Ms
#include<iostream>
#include<cstring>
using namespace std; int main()
{
int T;
string a,b;
int count1,count2;
cin>>T;
while(T--)
{
count1 = 0;
count2 = 0;
cin>>a>>b;
for(int i = 0;i<4;i++)
{
if(a[i] == b[i])
count1++;
else
{
for(int j = i+1;j<4;j++)
{
if(a[i] == b[j])
count2++;
if(b[i] == a[j])
count2++;
}
}
}
cout<<count1<<'A'<<count2<<'B'<<endl;
}
return 0;
}

POJ 3589 Number-guessing Game(简单题)的更多相关文章

  1. POJ 3632 Optimal Parking(简单题)

    [题意简述]:就是选择一个停车地点.然后走遍全部的store后,再回到停车地点.就是走一圈.问要走的距离是多少. [分析]:能够直接求出距离的最大值与最小值,求出差值.乘以2就是最后的输出结果. // ...

  2. Codeforces 828B Black Square(简单题)

    Codeforces 828B Black Square(简单题) Description Polycarp has a checkered sheet of paper of size n × m. ...

  3. HDU 6106 17多校6 Classes(容斥简单题)

    Problem Description The school set up three elective courses, assuming that these courses are A, B, ...

  4. leetcode简单题6

    今天的华师 Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, fro ...

  5. B. Lost Number【CF交互题 暴力】

    B. Lost Number[CF交互题 暴力] This is an interactive problem. Remember to flush your output while communi ...

  6. hectf2020部分简单题题解wp

    HECTF 我真是又菜又没时间肝题..又又又只水了波简单题... Reverse 1.Hello_Re file查一波 32bit,拖进IDA中 老规矩shift+F12 查看字符串: 跳转 F5查看 ...

  7. unctf2020 部分简单题题解

    unctf2020 水一波简单题..菜狗前来报道..大佬轻喷..如果有时间做题就好了呜呜呜 misc 1.baba_is_you 题目告诉我们,了解png文件格式. 下载得到一张png格式的图片. 用 ...

  8. BZOJ 2683: 简单题

    2683: 简单题 Time Limit: 50 Sec  Memory Limit: 128 MBSubmit: 913  Solved: 379[Submit][Status][Discuss] ...

  9. 【BZOJ-1176&2683】Mokia&简单题 CDQ分治

    1176: [Balkan2007]Mokia Time Limit: 30 Sec  Memory Limit: 162 MBSubmit: 1854  Solved: 821[Submit][St ...

  10. Bzoj4066 简单题

    Time Limit: 50 Sec  Memory Limit: 20 MBSubmit: 2185  Solved: 581 Description 你有一个N*N的棋盘,每个格子内有一个整数,初 ...

随机推荐

  1. 跟着鬼哥学so改动,一,准备篇

    图/文 听鬼哥说故事 闲话少说,so的改动,重要性大家都知道,这里从头编写so文件,分析so文件,改动so文件,打算做一个系列的教程,当然,主要是看时间同意. android的sdk配置以及ndk环境 ...

  2. 根据li标签 查找class="alcw4 alcw41"对应的值

    jrhmpt01:/root/lwp/0526# cat a2.pl use LWP::UserAgent; use DBI; use POSIX; use Data::Dumper; use HTM ...

  3. FZOJ2111:Min Number

    Problem Description Now you are given one non-negative integer n in 10-base notation, it will only c ...

  4. 批处理运行python

    @echo off cd C:\test start python test.py start python test2.py exit

  5. 使用Intent 将底层栈里所有的activity都清理掉

    可以利用清理历史栈的方法,来巧妙关闭所有activity,首先用一个设置为不可见的activity A来启动程序,这个activity A的作用只是用来垫栈底,只有启动和退出程序才会用到这个activ ...

  6. 怎样改动Myeclipse10.7的Servlet模板

    (1)在myeclipse10.0曾经的版本号中咱庄文件夹仅仅有叶仅仅需找到plugins在文件夹下找到: com.genuitec.eclipse.wizards_9.0.0.me201211011 ...

  7. dialog开发

    dialog开发屏幕编程:ok_code在程序里用sy-ucomm接受 调用其他事物代码:call transaction ‘SE38’. 1:50 选择屏幕之屏幕按钮: selection-scre ...

  8. bestcoder.hdu.edu.cn

    http://bestcoder.hdu.edu.cn/ Problem A 题目链接: http://bestcoder.hdu.edu.cn/contests/contest_showproble ...

  9. Windows的自带控件(比如TButton)大多数消息都由它自己处理,Delphi覆盖了那么多WM_函数优先级较低,一般用不上

    在空窗体上放一个TButton,一个TPanel,然后把在TWinControl.WMEraseBkgnd里下断点: procedure TWinControl.WMEraseBkgnd(var Me ...

  10. 14.2.5.1 Role of the .frm File for InnoDB Tables InnoDB .frm文件的作用

    14.2.5.1 Role of the .frm File for InnoDB Tables: 14.2.5.1 Role of the .frm File for InnoDB Tables I ...