problem | answer |
---|---|
This work belongs courses | C Programming Language 1 |
Where this requirement in the job | https://edu.cnblogs.com/campus/zswxy/CST2019-2 |
My aim in this course is | Skilled have some computer skills |
This job helped me achieve that goal in terms of specific | Repeated practice found in the course of a feeling, so I'm more familiar with computer |
references | "Question the wisdom" |
1.PTA lab assignments
1.1 1 topic name
计算序列 1 + 1/2 + 1/3 + ... 的前N项之和。
Input format:
input line in a given positive integer N.
Output format:
output section and the value S in accordance with the "sum = S" format in a row, six decimal place. Title ensure that the calculation result does not exceed the double precision.
Sample input:
23
sample output:
SUM = 2.549541
1.1.1 Data Processing
###数据表达:我定义了n, i, denominator,sum,item这些变量,这些变量的值都是我赋的值,前面3个是整型变量,后面两个是浮点型变量。
###数据处理:我用到了 item = 1.0/denominator, sum = sum + item,denominator = denominator + 2。用的是for循环流程结构。
1.1.2 Screenshot experiment code
1.1.3 Test data was
Input data | Output Data | Explanation |
---|---|---|
20 | cost=2.479673 | Less than 50 |
70 | cost=3.106007 | More than 50 |
50 | cost=2.937775 | Equal to 50 |
-4 | cost=0.000000 | Less than 50 |
1.1.4PTA submit a list and description
1. Wrong Answer: Some space problems, but also did not notice the decimal point to be retained at the beginning.
2. Wrong Answer: the expression is not accurate.
3. Compile Error: forget the code necessary to play, there is
4. Compile Error: Some semicolon did not notice.
5. Compile error: 6 No decimal place.
6. All correct: . .
1.2 Question 2
本题要求编写程序,计算序列 1 - 1/4 + 1/7 - 1/10 + ... 的前N项之和。
输入格式:
输入在一行中给出一个正整数N。
输出格式:
在一行中按照“sum = S”的格式输出部分和的值S,精确到小数点后三位。题目保证计算结果不超过双精度范围。
输入样例:
10
输出样例:
sum = 0.819
1.2.1 Data Processing
###数据表达:用到了 n, flag, denominator, i, sum, item这些变量,自己赋的值,前面3个是整型变量,后面2个是浮点型变量。
###数据处理:用到了 item = flag*1.0/denominator, sum = sum + item, flag = -flag, denominator = denominator + 3这些表达式,用的是for循环流程。
1.2.2 Code Screenshot
1.2.3 build test data
Input data | Output Data | Explanation |
---|---|---|
30 | cost=0.830 | Less than 50 |
90 | cost=0.834 | More than 50 |
50 | cost=0.832 | Equal to 50 |
-10 | cost=0.000 | Less than 50 |
1.2.4PTA submit a list and description
1. Compile Error: less defined variables.
2. Wrong Answer: Expressions order wrong.
3. Wrong Answer: Forget the variable assignment.
4. All correct: . .
2. Code peer assessment
同学代码截图
Own Code Screenshot
(1): They expression after the statement for only two expressions, I have three, because I defined a multi-variable than their item, so my expression than them.
(2): They're back to two expressions are merged, it seems simple, others are similar.
3. learning summary
3.1 learning progress bar
Week / Date | This week the time spent | Lines of code |
---|---|---|
October 16 | 2 hours | 30 |
October 17 | 2 hours | 50 |
10 May 18 | 4 hours | 20 |
3.2 Cumulative lines of code words and blog
time | Words blog | The number of lines of code |
---|---|---|
the first week | 300 | 45 |
the second week | 330 | 40 |
The third week | 840 | 110 |
the fourth week | 800 | 90 |
3.3 Summary and perception of learning content
3.3.1 learning content summary
在这一周中我们首先学习了华氏-摄氏度温度转换,紧接着学习了一种新的语法,for循环结构。在for循环结构中的括号里面有三个部分,包括赋值、限定条件和表达式。懂了for循环结构和保留精确度的结合,就像上次的if-else结合一样。这个for语句的经典例子就是从1加到n这种求和的问题。也是我们现在在练习的问题。
3.3.2 Learning Experience
在这一周的C语言学习过程中,我发现在课堂上比以前更加的有感觉一些了,能跟着老师的思路一步一步的走了。在本周的作业中比上次感觉不一样了,虽然还是有不懂,但是没关系,慢慢来吗。我觉得现在老师的这个上课思路很好,先讲作业,复习,上新课。可以让我们更加深刻。我觉得在后面的学习中应该要提前预习,走在老师的前面。