第二次卡
来源:互联网 发布:vod视频提取软件 编辑:程序博客网 时间:2024/04/28 19:56
题目:
Input contains an integer N in the first line, and then N lines follow.
Each line starts with a integer M, and then M integers follow in the same line.
For each group of input integers you should output their sum in one line,
and with one line of output for each line in input.
我的正确答案:
#include<stdio.h> int main(void) { int a,b=0,c,d=0,n,e=0; while(scanf("%d",&n)) { while(e<n) { while(scanf("%d",&c)){while(d<c){scanf("%d",&a);b=b+a;d++;}printf("%d%\n",b);d=0;b=0;} e++; } } }感觉很繁琐,其实我前面想着简化一下,可是学识有限,无从下手,如果哪位大佬愿意带带我,当然是最好不过啦。
这道题其实没什么要注意的,主要是记住每次循环时累加器要清零就可以啦。
0 0
- 第二次卡
- 第二次
- 第二次
- 第二次
- 第二次
- 第二次
- 第二次
- 第二次、
- 第二次
- 第二次
- 第二次
- 第二次
- 第二次
- 第二次
- 第二次作业,模拟sim卡与手机
- 第二次竞选
- 第二次约会
- 第二次会议记录
- PHP经典面试题目汇总
- Spark sbt-assembly 打包
- 微信小程序-文字超出限制如何在末尾加省略号
- CES展会的技术亮点奠定2017年各个行业的基调
- python基础学习笔记(个人学习时记录的笔记,不全的地方请大家指正)
- 第二次卡
- 欢迎使用CSDN-markdown编辑器
- 二叉树面试题
- 【c++】前言
- 96. Unique Binary Search Trees
- nginx安装配置脚本
- 自制NixieDisplay辉光数码管显示时钟
- 平衡车之mpu6050调试及问题总结
- Linux下PS1、PS2、PS3、PS4使用详解