265
社区成员
发帖
与我相关
我的任务
分享
1021
#include<bits/stdc++.h>
using namespace std;
int main()
{
string N;
cin>>N;
int num[10];
fill(num,num+10,0);//每一位数对应初始填充零
for(int i=0;i<N.length();i++)//读取到一个数字就在它对应的位数加一
{
num[N[i]-'0']++;
}
for(int i=0;i<10;i++)//分别输出出现次数不为零的数字及其对应位数上的数字
{
if(num[i]!=0)
{
cout<<i<<":"<<num[i]<<endl;
}
}
return 0;
}
1026
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
int c = ((b - a) + 50) / 100;
int d = n / 3600;//求出时
c = c % 3600;
int e = c / 60, f = c % 60;//求出分和秒
printf("%02d:%02d:%02d", d, e, f);
return 0;
}