首页 > 其他 > 详细

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

时间:2015-11-26 14:37:51      阅读:233      评论:0      收藏:0      [点我收藏+]

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

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

代码:

技术分享
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#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

 

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

原文:http://www.cnblogs.com/andyqsmart/p/4997323.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!