码迷,mamicode.com
首页 > 其他好文 > 详细

HDU 1000 A + B Problem(指针版)

时间:2017-04-08 20:32:57      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:mil   ane   ++   process   bit   can   iss   color   integer   

A + B Problem

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 654986    Accepted Submission(s): 204210

Problem Description
Calculate A + B.
 
Input
Each line will contain two integers A and B. Process to end of file.
 
Output
For each case, output A + B in one line.
 
Sample Input
1 1
 
Sample Output
2
 
Author
HDOJ
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1000
分析:我的第一道用指针做的题,初学指针,以前也从来没有用过指针,试试水,就来道A+B,大牛就不要喷了,Orz! 
下面给出AC代码:
 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 int main()
 4 {
 5     int *p,*q,m,n;
 6     int ans;
 7     p=&m;
 8     q=&n;
 9     while(scanf("%d%d",p,q)!=EOF)
10     {
11         ans=*p+*q;
12         printf("%d\n",ans);
13     }
14     return 0;
15 }

 

HDU 1000 A + B Problem(指针版)

标签:mil   ane   ++   process   bit   can   iss   color   integer   

原文地址:http://www.cnblogs.com/ECJTUACM-873284962/p/6682923.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!