// PAT团体程序设计天梯赛GPLT1~10
//
#include"stdafx.h"
#include<iostream>
#include<math.h>
#include<string>
usingnamespacestd;
int main()
{
L1-001
//cout<< "Hello Word!!!"<<endl;
L1-002. 打印沙漏
//int N, n;
//cin>> N;
//n = sqrt((N + 1) / 2);//计算一半的行数:
//for (inti = 0; i< n; i++)//先行
//{
// for (int j = 0; j < 2 * n - 2 * i - 1; j++)
// {
// cout<< "*";
// }
// cout<<endl;
//}
//for (inti = 1; i<= n - 1; i++)
//{
// for (int j = 0; j < 2 * i; j++)
// {
// cout<< "*";
// }
// cout<< "*";
// cout<<endl;
//}
//cout<< N - (2 * n*n - 1) <<endl;
L1 - 003. 个位数统计
//string s;
//cin>> s;
//intlen = s.length();
//int a[10] = { 0 };
//for (inti = 0; i<len; i++)
//{
// a[s[i] - '0']++;//a[s[i]变为int]中s[i]的个数
// //这里学习一种技术:string类型的数如“2”(代表数字50),然后-'0'后就是int类型的2。
//}
//for (inti = 0; i< 10; i++)
//{
// if (a[i] != 0)//跳过所有0的结果
// {
// cout<<i<< ":" << a[i] <<endl;
// }
//}
L1-004. 计算摄氏温度
//int f;
//cin>> f;
//cout<< "Celsius=" << 5 * (f - 32) / 9 <<endl;
//
//L1-005. 考试座位号
//L1 - 006. 连续因子
int n;
scanf("%d", &n);
int max = sqrt(n);
for (intlen = 12; len>= 1; len--)
{
for (int start = 2; start <= max; start++)
{
longlongintans = 1;
for (inti = start; i - start <= len - 1; i++)
{
ans *= i;
}
if (n%ans == 0)
{
cout<<len<< start;
for (inti = start + 1; i - start <= len - 1; i++)
cout<<i;
return 0;
}
}
}
cout<< n;
L1-007. 念数字
//string s;
//cin>> s;
//string t[10] = { "ling", "yi", "er", "san", "si", "wu", "liu", "qi", "ba", "jiu" };
//if (s[0]=='-')
//{
// cout<< "fu";
// for(inti = 1; i<= s.length(); i++)//在这个地方出问题了//希望有谁能帮助改改
// {
// cout<<" "<<t[s[i] - '0'];
// }
//}
//for (inti = 0; i<s.length(); i++)
//{
// cout<< " " << t[s[i] - '0'];
//}
L1-008. 求整数段和
//int a, b;
//cin>> a;
//cout<< " ";
//cin>> b;
//int temp = a;
//int sum = 0;
//while (temp <= b)
//{
// for (int j = 0; j < 5 && temp <= b; j++)
// {
// cout<< temp;
// sum += temp;
// temp++;//每次要输出的数+1;但不能加超过b
// }
// cout<<endl;//每5个数换行。
//}
//cout<< "Sum=" << sum;
//L1-009. N个数求和
L1-010. 比较大小
//int a, b, c;
//cin>> a >> b >> c;
//if (b > a)swap(a, b);
//if (c > a)swap(a, c);
//if (c > b)swap(b, c);
//cout<< c << "->" << b << "->" << a;
return 0;
}
PAT团体程序设计天梯赛练习题GPLT1~10
最新推荐文章于 2022-04-07 21:34:31 发布