Contest - 中南大学第六届大学生程序设计竞赛(Semilive)
题1:1160十进制-十六进制
注意他给的数据范围 2^31,int是 2^31-1
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include<iostream> using namespace std; int main() { unsigned int n; while(scanf("%u",&n)!=EOF) printf("0x%08X\n",n); return 0; }
题2:1161Sums
这题虽然是大数相加,但是有别于以前的大数相加,给你n(位),然后输入a,b,表示两个数的一位的数,然后相同位数的数字相加
这题的细节就是理解题意
1.The integers may contain leading zeroes.输出前导0;
2.Output exactly N digits in a single line.他给了几位输出几位,就算自高位进位了也无需理会
3. the next N lines contain two digits each.//digit就0-9
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include <stdio.h> int a[1000010]; int main(int argc, char *argv[]) { int i,n; int x,y; while(scanf("%d",&n)!=EOF) { for (i=0;i<n;i++) { scanf("%d%d",&x,&y); a[i]=x+y; } int c=0; for (i=n-1;i>=0;i--) { int s=a[i]+c; a[i]=s%10; c=s/10; } for (i=0;i<n;i++) printf("%d",a[i]); printf("\n"); } return 0; }