ACM学习历程—UESTC 1226 Huatuo's Medicine(数学)(2015CCPC L)

题目链接:http://acm.uestc.edu.cn/#/problem/show/1226

题目就是构造一个对称的串,除了中间的那个只有1个,其余的两边都是对称的两个,自然答案就是2*n-1

代码:

#include 
#include 
#include 
#include 
#include 
#include 
#include <set>
#include 
#include 
#include <string>
#define LL long long

using namespace std;

int main()
{
    //freopen("test.in", "r", stdin);
    int n, T;
    scanf("%d", &T);
    for (int times = 1; times <= T; ++times)
    {
        scanf("%d", &n);
        printf("Case #%d: %d\n", times, 2*n-1);
    }
    return 0;
}
View Code

 

转载于:https://www.cnblogs.com/andyqsmart/p/4997323.html

你可能感兴趣的:(ACM学习历程—UESTC 1226 Huatuo's Medicine(数学)(2015CCPC L))