1.个位数统计:

#include<stdio.h>
#include<iostream>
#include<string.h>
#include<set>
#include<vector>
#include<map>
#include<math.h>
#include<queue>
#include<string>
#include<stdlib.h>
#include<algorithm>
using namespace std;
char s[1005];
int n, a[10];
int main(){
while(gets(s)) {
memset(a, 0, sizeof a);
for(int i = 0; s[i]; i++)
a[s[i]-'0']++;
for(int i = 0; i < 10; i++)
if(a[i])
printf("%d:%d\n",i,a[i]);
}
return 0;
}

2. D进制的A+B
(20)

#include<stdio.h>
#include<iostream>
#include<string.h>
#include<set>
#include<vector>
#include<map>
#include<math.h>
#include<queue>
#include<string>
#include<stdlib.h>
#include<algorithm>
using namespace std;
#define ll long long
int D[1000];
ll a,b,d;
int main(){
while(~scanf("%lld %lld %lld",&a,&b,&d)) {
ll c = a+b;
int top = 0;
while(c) {
D[top++] = c%d;
c/=(ll)d;
}
if(top==0)D[top++] = 0;
for(int i = top-1; i >= 0; i--)
printf("%d", D[i]);
puts("");
}
return 0;
}

3.组个最小数
(20)

#include<stdio.h>
#include<iostream>
#include<string.h>
#include<set>
#include<vector>
#include<map>
#include<math.h>
#include<queue>
#include<string>
#include<stdlib.h>
#include<algorithm>
using namespace std;
int a[10];
int main(){
while(~scanf("%d",&a[0])) {
bool fir = false;
for(int i = 1; i < 10; i++) {
scanf("%d",&a[i]);
if(a[i] && fir==false) {
a[i]--;
fir = true;
printf("%d",i);
}
}
for(int i = 0; i < 10; i++)
while(a[i]--)printf("%d",i);
puts("");
}
return 0;
}

4.科学计数法
(20)

#include<stdio.h>
#include<iostream>
#include<string.h>
#include<set>
#include<vector>
#include<map>
#include<math.h>
#include<queue>
#include<string>
#include<stdlib.h>
#include<algorithm>
using namespace std;
char s[10005];
vector<int>G;
void put(){for(int i = 0; i < G.size(); i++)printf("%d",G[i]);}
int main(){
while(gets(s)) {
G.clear();
if(s[0]=='-')printf("-");
G.push_back(s[1]-'0');
int i = 3;
for(; s[i]!='E'; i++) G.push_back(s[i]-'0');
int add = s[++i]=='-'? 1 : -1;
int num = 0;
for(i++; s[i]; i++) num = num*10 + s[i]-'0';
num *= add;
num += (G.size()-1);
if(num>=(int)G.size()) {
printf("0.");
num--;
while(num>=G.size())printf("0"), num--;
for(i = 0; i < G.size(); i++)
printf("%d",G[i]);
}
else {
for(i = 0; i < G.size(); i++) {
if(num == G.size()-i)printf(".");
printf("%d",G[i]);
}
}
while(num<0)printf("0"), num++;
puts("");
}
return 0;
}

最新文章

  1. vue的选项
  2. 【BZOJ-3895】取石子 记忆化搜索 + 博弈
  3. poj1988(并查集)
  4. m=m++,结果让你大吃一惊。
  5. linux ar命令
  6. C#3
  7. java隐士类型转换和强制类型转换
  8. 【HDOJ】1042 N!
  9. light oj 1248 第六周E题(期望)
  10. 转:内核中的内存申请:kmalloc、vmalloc、kzalloc、kcalloc、get_free_pages
  11. SD3.0四个协议解读
  12. MapReduce 编程模型
  13. FMS用AS来实现拉流
  14. Omi架构与React Fiber
  15. Oracle进程与系统进程
  16. JAVA中子类会不会继承父类的构造方法
  17. Netty的并发编程实践1:正确使用锁
  18. 关于最新的APP上架流程
  19. Netty_TCP拆包粘包解决方案
  20. Mac下GTest的基本使用

热门文章

  1. 【codeforces 508E】Artur and Brackets
  2. Nutch命令大全
  3. Maven多模块项目搭建
  4. HDU 4329 Contest 3
  5. HDU 4300 Contest 1
  6. 每天学点Python之comprehensions
  7. hello world to php( mac 配置 xmapp virtual host)
  8. ACM这一路
  9. Binary Tree Inorder Traversal--leetcode
  10. tensorfllow MNIST机器学习入门