Contest - “青软杯”安徽科技学院第六届程序设计大赛_非专业组
Start time: 2015-04-18 08:00:00.0 End time: 2015-04-18 12:00:00.0
Current System Time: 2015-04-20 23:50:06.624 Contest Status: Ended
关于举办“青软杯”安徽科技学院
第六届程序设计大赛通知
ACM 国际大学生程序设计竞赛 (International Collegiate Programming Contest)是由美国计算机协会(ACM)主办的一项旨在展示大学生创新能力、团队精神和在压力下编写程序、分析和解决问题能力的著名竞赛。2010年以来,我校参与了历届安徽省 ACM 程序设计竞赛,并取得了优异的成绩。为选拔校 ACM 参赛队员,将举办“网博杯” 安徽科技学院第五届计算机程序设计大赛,热忱欢迎广大程序设计爱好者踊跃参加。
主办方:安徽科技学院教务处、校团委、数理与信息工程学院
承办方:数理与信息工程学院计算机系
赞助方:合肥青软动力科技有限公司
一、 比赛时间:2015 年 4 月 18(周六)上午 8:00~12:00
二、比赛地点:计算机与网络实验中心(力行楼六楼)
三、参赛对象:12~14 级计算机、网络、信息、电子等相关专业在校学生
四、 报名方式(免费报名参赛):
报名地点:力行楼六楼计算机网络实验中心人工智能实验室
报名时间:2014 年 3 月 18 日至 3 月 22 日
五、比赛设奖:设一等奖8%、二等奖12%、三等奖15%。
六、竞赛相关:
竞赛语言:C/C++/JAVA 环境:DevCpp /CodeBlock /Eclipse
比赛试题:采用 ICPC 样式——赛题 6~8 道
注意事项:
1. 练习比赛网站(安科 OJ):http://183.167.205.82:8081/JudgeOnline/
2. 计算机系 ACM/ICPC 学生活动室位于力行楼六楼,欢迎交流。
比赛 QQ 群:129073626(安科第六届校ACM大赛),内有相关资料和教程。
相关竞赛辅导将随后展开,请关注通知。
教务处、校团委、数理与信息工程学院
2015 年 3 月 11 日
Problem Id | Title |
1297 Problem A | 整数模 |
1304 Problem B | 趣味求和 |
1299 Problem C | C互质个数 |
1298 Problem D | B趣味求和 |
1300 Problem E | D重叠面积 |
1301 Problem F | A+B' |
1302 Problem G | F数圈圈 |
1303 Problem H | 谁比较2 |
代码为本人AC代码,最后附上几道难题的参考代码
1297 Problem A | 整数模 |
整数模
Time Limit:1000MS Memory Limit:65536K
Total Submit:30 Accepted:10
Description
a除以m的余数称为a对于m的模。求a^p对于m的模。
Input
输入数据中含有一些数据组,每个数据组占一行,包括a、p、m(0<a,p<2^32,1≤m<2^16)三个整数,若三个数都为0,则表示输入结束。
Output
针对每组数据,输出a的p次幂对于m的模,每个结果占一行。
Sample Input
3 18132 17
0 0 0
Sample Output
13
Source
#include<iostream>
using namespace std;
int main()
{
long long a,p,m;
while(cin>>a>>p>>m)
{
long long ans=1;
if(a==0&&p==0&&m==0)
break;
for(int i=0; i<p; i++)
ans=ans*a%m;
cout<<ans<<endl;
}
return 0;
}
1299 Problem C | C互质个数 |
C互质个数
Time Limit:1000MS Memory Limit:65536K
Total Submit:21 Accepted:8
Description
贝贝、妞妞和康康都长大了,如今,他们已届小学毕业,老师给贝贝出了一道强化计算的题目,让她做一大堆除法,以确定两个数之间是否有公共的因子,并且还要数清楚没有公因子的数对。可是,毕竟有些数太大了,量又太多了,即使她与妞妞和康康联手,也没有耐心在一个小时做完这种吃力的事情啊。虽然他们真的知道该怎么做,可是,他们的心早就飞到海边的沙滩上了,想尽情地玩,但眼看又不能。能不能帮他们“减负”,尽早放飞心情,那就要靠你了。
Input
输入若干组(≤100组)整数(每个整数n满足0< n < 2^32),每组整数(个数≤50)占一行(第一个数代表数字个数)。
Output
对每组整数,输出其彼此互质的个数,每个结果单独占一行。
Sample Input
6 27 91 18 2 5 9
4 13 5 60 12
Sample Output
11
4
Source
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int jt(int a,int b)
{
return b==0?a:jt(b,a%b);
}
int main()
{
int n,a[100]= {0};
while(cin>>n)
{
int ans=0;
memset(a,0,sizeof(a));
for(int i=0; i<n; i++)
cin>>a[i];
for(int i=0; i<n; i++)
for(int j=i+1; j<n; j++)
if(jt(a[i],a[j])==1)
ans++;
cout<<ans<<endl;
}
return 0;
}
1298 Problem D | B趣味求和 |
B趣味求和
Time Limit:1000MS Memory Limit:65536K
Total Submit:68 Accepted:14
Description
编写一个程序,求Sn=a+aa+aaa+……+aa…aaa(有n个a)的值,其中a是一个数字。
Input
输入数据含有不多于50组的数据,每组数据由两个正整数(0<a, n < 10)组成。
Output
对于每组数据a和n,计算Sn=a+aa+aaa+……+aa…aaa(有n个a)的值,每个计算结果应单独一行。
Sample Input
5 2
5 1
Sample Output
60
5
Source
#include<iostream>
using namespace std;
int main()
{
int a,n;
while(cin>>a>>n)
{
long long sb=0,sum=0;
for(int i=0;i<n;i++)
{
sb=sb*10+a;
sum+=sb;
}
cout<<sum<<endl;
}
return 0;
}
1300 Problem E | D重叠面积 |
D重叠面积
Time Limit:1000MS Memory Limit:65536K
Total Submit:50 Accepted:16
Description
zjahstu是个很厚道的ACMer,O(∩_∩)O~。。特为大家准备水题一道。。
题目很简单,两个矩形,告诉你矩形1,矩形2的面积和他们的总面积,请你求两矩形重叠部分的面积。如果给你的情况不存在,就输出Impossible。
Input
第一个数是T,表示测试数据的组数。 后面有T行,每行3个整数(1~10000)。
Output
输出阴影部分的面积或者Impossible。
Sample Input
3
20 20 40
20 20 30
20 20 50
Sample Output
0
10
Impossible
Source
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
while(n--)
{
int a,b,c;
cin>>a>>b>>c;
if(a+b<c)cout<<"Impossible"<<endl;
else cout<<(a+b-c)<<endl;
}
return 0;
}
1301 Problem F | A+B' |
A+B'
Time Limit:1000MS Memory Limit:65536K
Total Submit:35 Accepted:14
Description
A+B'
Input
0 < =A,B < =1e6
Output
输出答案
Sample Input
4 3
27 12
100 200
Sample Output
7
48
102
Hint
B'就是B反过来啦
Source
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
//Sample Input
//4 3
//27 12
//100 200
//Sample Output
//7
//48
//102
using namespace std;
long long f(long long n)
{
long long sum=0,a[10]= {0},i=0,m=n;
if(m<10)return m;
else
{
while(m)
{
a[i]=m%10;
i++;
m/=10;
}
for(int j=0; j<i; j++)
sum=sum*10+a[j];
return sum;
}
}
int main()
{
long long a,b;
while(cin>>a>>b)
{
long long sum=f(b);
cout<<a+sum<<endl;
}
return 0;
}
1302 Problem G | F数圈圈 |
F数圈圈
Time Limit:1000MS Memory Limit:65536K
Total Submit:39 Accepted:13
Description
幼儿园的小朋友对数字其实不是很感兴趣,他们更感兴趣的是形状,现在给你一个数字,小朋友都会数出其中一共有多少圆圈圈
Input
一个数字n长度不超过19位
Output
输出其中的圈圈数总数
Sample Input
14589
20869
12357
Sample Output
Hint
3 5 0
Source
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
using namespace std;
int main()
{
string s;
while(cin>>s)
{
int sum=0;
for(int i=0;i<s.length();i++)
{
if(s[i]=='0')sum++;
if(s[i]=='6')sum++;
if(s[i]=='8')sum+=2;
if(s[i]=='9')sum++;
}
cout<<sum<<endl;
}
return 0;
}
1303 Problem H | 谁比较2 |
谁比较2
Time Limit:1000MS Memory Limit:65536K
Total Submit:19 Accepted:12
Description
定义一个整数N中的2的指数为N二的级别,比如4=2^2则4的二度为2,6=2^1*a则6的二度为1
你的任务就是给出a,b中谁更2
Input
给出a,b 都是正数且不超过10000000
Output
给出a,b中谁更2
Sample Input
4 6
17 4
4 12
Sample Output
>
<
=
Source
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
using namespace std;
int jt(long long n)
{
int ans=0;
long long m=n;
if(m%2==1)return 0;
while(m%2==0)
{
ans++;
m/=2;
}
return ans;
}
int main()
{
long long a,b;
while(cin>>a>>b)
{
int x=jt(a),y=jt(b);
if(x>y)cout<<">"<<endl;
else if(x==y)cout<<"="<<endl;
else cout<<"<"<<endl;
}
return 0;
}