先来看个引例,方便理解:求857各个为位(个位、十位,百位)上的数,谁都知道8和5和7嘛; 857%10==7; 857/10==85 (其实==85.7,但是C语言里面,int类型是向下取整的,所以是85) 85 % 10==5; 85/10==8 (同理) 8 % 10==8; 8/10==0 和10进制一样 26进制,满26进1,一个数除以26取余也就得到...
#include<bits/stdc++.h>usingnamespacestd;intmain(){intn;charc; cin >> n >> c;intm =round(n *1.0/2);for(inti =0; i < m; ++i) {for(intj =0; j < n; ++j) cout << c; cout << endl; }return0; } L1-016 查验身份证 (15 分)# 水题,就是麻烦了点。 Copy #include<bi...
代码语言:javascript 复制 #include<stdio.h>intmain(){intN;scanf("%d",&N);double h;char x;int i;for(i=1;i<=N;i++){getchar();scanf("%c %lf",&x,&h);if(x=='F')printf("%.2lf\n",h*1.09);if(x=='M')printf("%.2lf\n",h/1.09);}return0;}...
L1-017 到底有多二 一个整数“犯二的程度”定义为该数字中包含2的个数与其位数的比值。如果这个数是负数,则程度增加0.5倍;如果还是个偶数,则再增加1倍。例如数字 -13142223336是个11位数,其中有3个2,并且是负数,也是偶数,则它的犯二程度计算为:3/11×1.5×2×100%,约为81.82%。本题就请你计算一个给定整...
上代码: #include <iostream>usingnamespacestd;intmain() {strings; cin>>s;intnum=0;intlen;floatres;//char c=s[0];//bool b=(s[0]=='-');for(inti=0;i
代码语言:javascript 复制 #include<stdio.h>intmain(){char h1,h2;char m1,m2;scanf("%c %c:%c %c",&h1,&h2,&m1,&m2);//printf("%c %c",h1,h2);//printf("%c %c %c %c",h1,h2,m1,m2);int h=(h1-'0')*10+(h2-'0')*1;int m=(m1-'0')*10+(m2-'0')*1;//printf(...