第二章
编程作业
#include <iostream>
using namespace std;
int main()
{
int n, temp, min, max, sum=0;
cin>>n>>temp;
min = max = temp;
n -= 1;
sum += temp;
while(n--)
{
cin>>temp;
sum += temp;
min = temp<min ? temp: min;
max = temp>max ? temp: max;
}
cout<<sum<<" "<<min<<" "<<max;
return 0;
}
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int num, sum=0;
cin>>num;
for(int i=0; num!=0; i++)
{
sum += num%10*pow(2, i);
num /= 10;
}
cout<<sum;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1; i<=n; i++)
{
for(int j=1; j<=n-i; j++)
cout<<" ";
for(int j