安徽科技学院 2014-2015-2学期计算机14级12班《C语言程序设计II》期末考试
Contest - 2014-2015-2学期计算机14级12班《C语言程序设计II》期末考试
Start time: 2015-07-03 19:05:00.0 End time: 2015-07-03 21:35:00.0
Current System Time: 2015-07-06 01:12:32.52 Contest Status: Ended
Problem Id | Title |
1321 Problem A | 10000小时定律 |
1319 Problem B | 四方定理 |
1312 Problem C | A difficult problem |
1313 Problem D | DNF又爆满啦 |
1314 Problem E | 奇幻数字 |
1315 Problem F | 差值最大 |
1316 Problem G | 字符串替换 |
1107 Problem H | 闰年 |
[Standings] [Status] [Statistics]
闰年 Time Limit:1000MS Memory Limit:65536K Description 输入年份判断是否是闰年,如果是则输出“yes"否则输出"no" Input 输入年份判断是否是闰年, Output 如果是则输出“yes"否则输出"no" Sample Input 1900 Sample Output no Source lrj程序入门 |
[Submit] [Go Back] [Status] [Discuss]
表示这道题不是我出的,是最后为了让所有人最少AC一题的目标,从OJ上直接拿来的,简单,代码也少。
#include "iostream"//n久以前写的,姑且一看
using namespace std;
int main()
{int year;cin>>year;if((year%4==0&&year%100!=0)||year%400==0)cout<<"yes"<<endl;else cout<<"no"<<endl;return 0;
}
1312、
A difficult problem Time Limit:1000MS Memory Limit:65536K Description Today, I want to take a few minutes to speak with you-directly and clearly-about Ebola: what we're doing about it, and what you need to know. Because meeting a public health challenge like this isn't just a job for government. All of us-citizens, leaders, the media-have a responsibility and a role to play. This is a serious disease, but we can't give in to hysteria or fear-because that only makes it harder to get people the accurate information they need. We have to be guided by the science. We have to remember the basic facts. So here's the problem that when I give you two numbers you should give me the (opposite of the first number) plus one. Input You will be given two numbers in the input Output please read the problem . Sample Input 12 34567891011 -999 753951 Sample Output -11 1000 Hint 这是一道难题。。。。。。。。目测亚洲区域赛难度。。。。。。 Source |
[Submit] [Go Back] [Status] [Discuss]
这题我都不想再讲了,同学们看到英文题就感觉很难,外表不代表内在哎,最后在hint里都加上了oppsite的意思了,都没人写,表示我非常伤心,唉,,,题意很简单 第一个数取反然后加一,注意使用long long
/*** Project Name: C++* File Name: A_difficult_problem.cpp* Created on: 2015年6月23日 下午2:57:16* Author: jtahstu* QQ: 1373758426 E-mail:1373758426@qq.com* Copyright (c) 2015, jtahstu , All Rights Reserved.*/
#include<iostream>
#include<cstdlib>
using namespace std;
int main() {//freopen("A.in", "r", stdin);//freopen("A.out", "w", stdout);long long a, b;while (cin >> a >> b) {cout << -a + 1 << endl;}return 0;
}
1313、
DNF又爆满啦 Time Limit:1000MS Memory Limit:65536K Description 《地下城与勇士》是一款韩国网络游戏公司NEOPLE开发的免费角色扮演2D游戏,由三星电子发行,并于2005年8月在韩国正式发布。中国则由腾讯游戏代理发行于2008年6月。 Input 多组测试数据 Output 每个输出一行,依次输出爆满的频道个数,拥挤的频道个数和顺畅的频道个数 Sample Input 12345 20000 66666 Sample Output 12 0 55 20 0 47 66 1 0 Source |
[Submit] [Go Back] [Status] [Discuss]
哈,说道这题,当时我地下城在挂机就胡乱想到的,简单的一塌糊涂
/*** Project Name: C++* File Name: DNF.cpp* Created on: 2015年6月23日 下午11:58:40* Author: jtahstu* QQ: 1373758426 E-mail:1373758426@qq.com* Copyright (c) 2015, jtahstu , All Rights Reserved.*/
#include<iostream>
#include<cstdlib>
using namespace std;
int main() {// freopen("A.in", "r", stdin);//freopen("A.out", "w", stdout);int n;while(cin>>n) {int bao=0,yong=0,shun=0;bao=n/1000;if(n%1000>=500)yong++;shun=67-bao-yong;cout<<bao<<" "<<yong<<" "<<shun<<endl;}return 0;
}
1314、
奇幻数字 Time Limit:1000MS Memory Limit:65536K Description 给定两个整数m,n,统计1-n的整数中有多少个奇幻数字,只要满足以下两个条件的任意一个,我们就称其为奇幻数字. Input 第一个数是T,表示测试数据的组数。 后面有T行,包括两个整数m和n,m∈[1,9]且m∈Z n∈[1,1000000] Output 输出奇幻数字的个数。 Sample Input 2 3 20 2 100 Sample Output 7 55 Source |
[Submit] [Go Back] [Status] [Discuss]
数字的模和除运算,没什么难度,可能不少人对分离一个数的各个位有疑惑,监考的时候发现好多人竟然就是写七个式子求然后比较,我只想说,我不想难为你,这要是很大的范围那怎么行呢,还是用循环吧。
/*** Project Name: C++* File Name: 奇幻数字.cpp* Created on: 2015年6月23日 下午3:32:48* Author: jtahstu* QQ: 1373758426 E-mail:1373758426@qq.com* Copyright (c) 2015, jtahstu , All Rights Reserved.*/#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
bool test1(int i, int m) {if (i % m == 0)return true;return false;
}
bool test2(int i, int m) {int i1 = i;while (i1) {if (i1 % 10 == m)return true;i1 /= 10;}return false;
}
int main() {//freopen("A.in", "r", stdin);//freopen("A.out", "w", stdout);int t, m, n;cin >> t;while (t--) {int count = 0;cin >> m >> n;for (int i = 1; i <= n; i++)if (test1(i, m) || test2(i, m))count++;cout << count << endl;}return 0;
}
1315、
差值最大 Time Limit:1000MS Memory Limit:65536K Description 在给定的一个m*n的矩阵中,计算各列或各行累加和中最大值与最小值的差 Input 多组测试数据 Output 输出最大的差值,每组数据输出一行 Sample Input 3 3 1 4 7 2 5 8 3 6 9 0 0 Sample Output 18 Source |
[Submit] [Go Back] [Status] [Discuss]
二维数组的求和,知道行和列怎么求和,虽然这题看上去不难,实际上很多算法就是在操纵i,j值,实现一些很巧妙地运算,需要大量训练,细细体会。
/*** Project Name: C++* File Name: 差值最大.cpp* Created on: 2015年6月23日 下午8:15:39* Author: jtahstu* QQ: 1373758426 E-mail:1373758426@qq.com* Copyright (c) 2015, jtahstu , All Rights Reserved.*/
#include<iostream>
#include<cstdlib>
using namespace std;
int main() {//freopen("A.in", "r", stdin);// freopen("A.out", "w", stdout);int m, n;while (cin >> m >> n) {if (m == 0 && n == 0)break;int a[55][55] = { 0 }, max = -1, min = 10000000;for (int i = 0; i < m; i++)for (int j = 0; j < n; j++)cin >> a[i][j];for (int i = 0; i < m; i++) { //计算每行累加和的最大最小值int sum = 0;for (int j = 0; j < n; j++) {sum += a[i][j];}if (sum > max)max = sum;if (sum < min)min = sum;}for (int j = 0; j < n; j++) { //计算每列累加和的最大最小值int summ = 0;for (int i = 0; i < m; i++) {summ += a[i][j];}if (summ > max)max = summ;if (summ < min)min = summ;}cout << max - min << endl;}return 0;
}
1316、
字符串替换 Time Limit:1000MS Memory Limit:65536K Description 编写一个程序实现将字符串中的所有"you"替换成"we",如果不包含"you",则原样输出。 Input 输入包含多行数据 Output 对于输入的每一行,输出替换后的字符串 Sample Input you are good man you And Me You with you Sample Output we are good man we And Me You with we Source |
[Submit] [Go Back] [Status] [Discuss]
考虑题目难度没有给一些奇怪的字符,让很多人给第三个位置随便符一个值都能过,因为测试数据就都是字母,不想搞难了,毕竟就是水题。
/*** Project Name: C++* File Name: 字符串替换.cpp* Created on: 2015年6月23日 下午10:41:22* Author: jtahstu* QQ: 1373758426 E-mail:1373758426@qq.com* Copyright (c) 2015, jtahstu , All Rights Reserved.*/
#include<iostream>
#include<string>
using namespace std;
int main() {//freopen("A.in", "r", stdin);// freopen("A.out", "w", stdout);string s;while (getline(cin, s)) {string s2 = "we";for (int i = 0; i < s.length(); i++) {if (s[i] == 'y' && s[i + 1] == 'o' && s[i + 2] == 'u') {s.replace(i, 3, s2);}}cout << s << endl;}return 0;
}
1319、
四方定理 Time Limit:1000MS Memory Limit:65536K Description 数论中著名的“四方定理”讲的是:所有自然数至多只要用四个数的平方和就可以表示。 Input 输入包含多行数据 Output 由于可能会出现多种情况,依次输出最小的a,b,c,d即可 Sample Input 110 211 520 Sample Output 0 1 3 10 0 3 9 11 0 0 6 22 Source |
[Submit] [Go Back] [Status] [Discuss]
暴力可以过,没啥难度,但是你要知道break只能提跳一个for循环啊,监考时给不下三个人改了这题代码,很多人不知道
/*** Project Name: C++* File Name: 四方定理.cpp* Created on: 2015年6月23日 下午11:08:40* Author: jtahstu* QQ: 1373758426 E-mail:1373758426@qq.com* Copyright (c) 2015, jtahstu , All Rights Reserved.*/
#include<iostream>
#include<cstdlib>
using namespace std;
int main() {freopen("A.in", "r", stdin);freopen("A.out", "w", stdout);int n;while (cin >> n) {bool flag = true;for (int i = 0; i * i <= n; i++) //穷举if (flag) {for (int j = 0; j * j <= n; j++)if (flag)for (int k = 0; k * k <= n; k++)if (flag)for (int l = 0; l*l <= n; l++)if (i * i + j * j + k * k + l * l == n) {cout << i << " " << j << " " << k << " "<< l << endl;flag = false;}}}return 0;
}
1321、
10000小时定律 Time Limit:1000MS Memory Limit:65536K Description 作家格拉德威尔在《异类》一书中指出: Input 多组测试数据,输入以EOF结束 Output 输出她成为大牛的日期,输出格式见示例 Sample Input 2015/6/23 1 2015/9/1 8 Sample Output 2042/11/14 2019/2/2 Hint 其实对于成功者来说,不管练习的过程枯燥与否,有趣与否,他们都必将付出远远超出常人的代价。心甘情愿花上一万个小时来打通任督二脉的人,大都不是寻常之辈。 Source |
[Submit] [Go Back] [Status] [Discuss]
这题还是我上JAVA课想出来的,加上之前看到的这个励志小故事,结果就想出来这么一道题,虽然就有两个人提交,虽然那写的也不对,但题目还是出了一点问题,我自己写的代码有点问题,导致测试数据不对,实际是有的对,有的又不对,这题废了我很长时间的,最后考完试把测试数据和标程改过来的,还是挺抱歉的。
/*** Project Name: C++* File Name: 10000Hours.cpp* Created on: 2015年6月23日 上午10:04:18* Author: jtahstu* QQ: 1373758426 E-mail:1373758426@qq.com* Copyright (c) 2015, jtahstu , All Rights Reserved.*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
const int N = 10000;
const int d[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int calc(int month, int day) { //计算这一年还有多少天int days = 0;for (int i = month + 1; i <= 12; i++)days += d[i];return days + (d[month] - day + 1);
}
int main() {// freopen("A.in","r",stdin);//freopen("A.out","w",stdout);int Satrt_year, Start_month, Start_day, hour;while (~scanf("%d/%d/%d %d", &Satrt_year, &Start_month, &Start_day, &hour)) {int days;int End_year = Satrt_year, End_month = Start_month, End_day;if (N % hour)days = N / hour + 1;elsedays = N / hour;while (days >= 365) {End_year++;days -= 365;}if (calc(Start_month, Start_day) > days) { //如果就在这一年内//cout<<calc(Start_month, Start_day) <<endl;//cout<<days<<endl;if (days >= d[Start_month] - Start_day + 1) { //如果不在起始的月份End_day = 0;End_month++;days =days-( d[Start_month] - Start_day + 1);for (int i = Start_month + 1; i <= 12; i++) {if (days >= d[i]) {End_month++;days -= d[i];}}End_day=days;//卧槽,这里多次一举的,妈蛋
// End_day = Start_day + days; //这里相加可能会大于这个月的天数
// if (End_day > d[End_month]) {
// End_month++;
// End_day -= d[End_month - 1];
// }} else { //如果恰好在起始的月份End_day = Start_day + days;}} else { //如果到达下一年End_month = 1;End_day = 0;days -= calc(Start_month, Start_day);End_year++;for (int i = 1; i <= 12; i++) {if (days >= d[i]) {End_month++;days -= d[i];}}End_day += days;}cout << End_year << "/" << End_month << "/" << End_day << endl;}return 0;
}
最后排名:
最后成绩也可看到,基本都是5道、4道题,最少2题,都及格了,这和我们去年的期末考试难度降得不要太多,大家开开心心结束了为期两学期的c语言学习,编程也算入门了,后面的路还有很长,望大家不忘努力,努力什么时候都不晚,珍惜时间,大学四年很快,很快。
安徽科技学院 2014-2015-2学期计算机14级12班《C语言程序设计II》期末考试相关推荐
- C语言程序设计二期末考试,9第二学期期末考试《C语言程序设计》A
期末试题 二级c语言 ------------装------------订-------------线------------安徽工业大学题纸(一) 2009~2010学年第一学期期末考试<C程 ...
- 安徽科技学院计算机二级,安徽科技大学2017年3月计算机二级考试报名时间
根据安徽省教育招生考试院要求,安徽科技学院2017年上半年全国计算机二级考试定于2017年3月25日至28日(具体时间见准考证)举行.本次考试报名工作具体安排如下: 一.开考科目.级别 二.报名及缴费 ...
- 安徽科技学院2017-2018-1学期15电信12《Java编程技术》期末考试
安徽科技学院2017-2018-1学期15电信12<Java编程技术>期末考试 缘分真是一个奇妙的东西,说来就来 可惜快乐的时光总是过得很快 JAVA程序设计课程就酱紫画上句号了,真的很不 ...
- 安徽信息工程学院计算机在哪个校区,安徽科技学院有几个校区及校区地址 哪个校区最好...
安徽科技学院有几个校区及校区地址 哪个校区最好2018-06-16 09:55:51文/赵妍妍 最近有很多考生和家长咨询小编,安徽科技学院有几个校区,今年新生会被分配到哪个校区?哪个校区好?等相关问题 ...
- “青软杯”安徽科技学院第六届程序设计大赛_专业组
Contest - "青软杯"安徽科技学院第六届程序设计大赛_专业组 Start time: 2015-04-18 08:00:00.0 End time: 2015-04- ...
- 2016 Bird Cup ICPC7th@ahstu--“波导杯”安徽科技学院第七届程序设计大赛
"波导杯"安徽科技学院第七届程序设计大赛 原文章网页 Contest - 2016 "Bird Cup" ICPC7th@ahstu Start time: ...
- c语言程序设计课程总结600字,2019年春季学期《C语言程序设计II》课程总结
2019年春季学期<C语言程序设计II>课程总结 1.课程情况 2.课程总结 学生的课程总结: 本学期的目标 让课程形成模式,在较为清晰的教学内容的基础上,形成可持续性的教学管理方式,让同 ...
- 春学期C语言程序设计,2019年春季学期《C语言程序设计II》课程总结
2019年春季学期<C语言程序设计II>课程总结 ####1.课程情况 ####2.课程总结 ###学生的课程总结: ###本学期的目标 让课程形成模式,在较为清晰的教学内容的基础上,形成 ...
- c 语言程序设计教程 沈显君 答案,CD3计算机实践《C/C++语言程序设计》报告模板2.doc...
CD3计算机实践<C/C语言程序设计>报告模板2 计算机实践-C/C++语言程序设计报告- PAGE 10 -- PAGE 12 - 计算机实践C/C++程序设计报告 指导教师学号1207 ...
最新文章
- 天之痕java版不能捉妖_〖天之痕游戏常见问题汇总(更新版)〗
- ubuntu14.06 Lts开启ssh服务
- 三种方式搭建yum源
- 011_logback中的SMTPAppender
- Linux内核--内核地址空间分布和进程地址空间
- Gensim Word2vec 使用教程
- c++随机数函数rand()
- python 求子字符串_求子串-KPM模式匹配-NFA/DFA
- MATLAB语音识别
- 控制台程序不显示dos窗口的方法
- IDEA导入本地项目
- vue中报warnings potentially fixable with the `--fix` option.
- 渝粤题库 国家开放大学 学前儿童语言教育 期末考试复习资料
- PMP证书含金量再次提升,纳入北京工作居住证办理范围
- 阿里sentinel监控客户端配置
- 从反反鸡汤谈过犹不及
- 币市强震,来点理性的心理按摩
- 如何用matlab演奏《偏爱》
- 什么是企业邮箱星标联系人?
- Outlook Express 错误完整代码表-网管专栏,邮件服务