1376: 小雨想要設定密碼
時間限制: 1 Sec 記憶體限制: 128 MB
提交: 649 解決: 472
[提交][狀態][討論版]
題目描述
生活中經常會遇到需要設定密碼的情況,小雨可煩了,他想到一個辦法,首先找到n個幸運數字,然后在這幾個幸運數字的基礎上,構造一個回文數作為密碼,
比如:幸運數字是123,那么構造成的密碼就是12321,最后一個幸運數字不重復,
輸入
第一行一個整數表示n,
第二行n個整數,依次表示幸運數字,
輸出
一串不間隔的整數,表示構造出來的密碼,
樣例輸入
3
123
樣例輸出
12321
提示
來源
普及二期,一維陣列
[提交][狀態][討論版]
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<cmath>
#include<cstring>
using namespace std;
int main()
{
int a[100];
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
cout<<a[i];
}
for(int i=n-1;i>=1;i--)cout<<a[i];
return 0;
}
Anything about the Problems, Please Contact :Administrator
All Copyright Reserved 2010-2014 福建師大附中 TEAM
GPL2.0 2003-2013 HUSTOJ Project TEAM
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/376968.html
標籤:其他
