北航1000(A+B)
来源:互联网 发布:数据分析有前途吗 编辑:程序博客网 时间:2024/05/01 04:36
初次写这中格式的程序,好纠结,不知道怎么入门了都!写这个程序的最大收获就是自己得要学会有条理的思考问题了.....
#include<stdio.h>
//结构体保存数据与结果
struct Plus
{
int a,b;
int res;
struct Plus *next;
};
int main(int argc,char* argv[])
{
int num;
struct Plus *head,*Prev,*Mid,*Free;
Free=Prev=head=Mid=(struct Plus*)malloc(sizeof(struct Plus));
//输入数据组数以及各组数据
scanf("%d",&num);
if(num==0)
return 0;
while(num--)
{
scanf("%d,%d",&Mid->a,&Mid->b);
Mid->res=Mid->a+Mid->b;
Mid=(struct Plus*)malloc(sizeof(struct Plus));
Prev->next=Mid;
Prev=Mid;
if(num==0)
Mid->next=NULL;
}
//输出各组结果
while(NULL!=head->next)
{
printf("%d\n",head->res);
head=head->next;
}
//释放资源
head=Free;
while(NULL!=Free)
{
head=Free->next; //释放之前保存下一个链表头
free(Free);
Free=head;
}
return 0;
}
在以前一般不会有这种格式的输入连续的,一般都是单一的输入或者输出了,以后得学会理理思路了
- 北航1000(A+B)
- 1000 A+B Problem
- 1000 A+B Problem
- 1000:A-B
- 1000 A + B Problem
- 1000 A+B Problem
- zoj 1000【a+b】
- 1000 A + B Problem
- 1000:A+B problem
- HUST 1000 A+B
- hdu 1000 A+B
- wikioi 1000 A+B
- xmu 1000 A+B
- 1000 A + B Problem
- poj 1000 a+b
- 1000:A+B
- HiHo 1000 A+B
- 1000 A+B Problem
- 2012 3 16
- 如何让字符串排序某几项显示在最前面
- 直连线和交叉线制作区别及使用方式
- UITextView控件的用法详解
- jquery ligerUI中的single是指什么
- 北航1000(A+B)
- iphone开发中九宫格的界面布局的实现
- 当你走不下去的时候
- 什么是表驱动
- NPC框架
- 在XCode 4中使用TODO FIXME等标记
- mysql从两个表中选择数据并统一排序
- C++ modularization framework (like OSGI)
- 人生不能等待的三件事