c++ using namespace std;要有 不要注释 求a/b的结果。 已知a,b为10^8范围内的非负整数,求a/b保留前n位小数商的结果。


```cpp #include <iostream> using namespace std; int main() { long long a, b; int n; cin >> a >> b >> n; cout << a / b; if (n > 0) { cout << "."; a %= b; for (int i = 0; i < n; i++) { a *= 10; cout << a / b; a %= b; } } return 0; } ``` [2025-09-26 19:15:23 | AI问答 | 127点数解答]
相关提问
- using communication_protocols; using FTS_F02391A; using NLog; using ScottPlot.Plottable; using Sunny.UI; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; namespace 窗体界面设计 { public partial class FormHome : UIPage { private readonly DataLogger Log1;//波形图数据记录器 bool bViewSlide = false(562点数解答 | 2025-07-09 16:57:56)89
- 定义具有继承关系的点类point和圆类circle和测试类mainclass, point类具有x,y两个属性,用于表示点的坐标(整数),为point类添加相应构造方法point(x,y)。(2)circle类为point类的子类,它本身包含半径radius(整数),为circle类添加相应构造方法circle(x,y ,radius),求周长(小数)getperi ()和求面积(小数)getarea0)的方法,在方法中打印相关结果(公式:周长=2*3.14*半径,面积=3.14*半径*半径)。 (3)创建测试类mainclass,在其main方法中创建circle类对象c,圆心坐标(50,30),半径为4,调用对象c的相关方法打印的圆的周长和面积。(246点数解答 | 2024-11-11 16:36:30)213
- using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace teachingmanagementsystem { class program { static void main(string[] args) { console.writeline("欢迎使用简易教学管理系统"); // 创建课程列表 list<course> courses = new list<course> { new course("数学"), new course("英语"), new course("物理") }; // 创建学生(419点数解答 | 2024-10-24 17:49:32)168
- c++ using namespace std;要有 不要注释 求a/b的结果。 已知a,b为10^8范围内的非负整数,求a/b保留前n位小数商的结果。(127点数解答 | 2025-09-26 19:15:23)6
- 若一个数(首位不为零)从左向右读与从右向左读都是一样,我们就将其称之为回文数。例如:给定一个 10进制数 56,将 56加 65(即把56从右向左读),得到 121是一个回文数。又如,对于10进制数87, STEP1: 87+78= 165 STEP2: 165+561= 726 STEP3: 726+627=1353 STEP4:1353+3531=4884 在这里的一步是指进行了一次N进制的加法,上例最少用了4步得到回文数4884。 写一个程序,给定一个N(2<N<=10或N=16)进制数 M.求最少经过几步可以得到回文数。如果在30步以内(包含30步)不可能得到回文数,则输出“Impossible” 。 c++ using namespace std;要有 不要注释(491点数解答 | 2025-09-26 19:16:14)7
- 请求出1!+2!+3!+4!+…+n!,请注意,n<=50。 n!=nx(n-1)x(n-2)x…x1,如:5!=5x4x3x2x1=120。 c++ using namespace std;要有 不要注释(99点数解答 | 2025-09-26 19:32:04)5
- 请求出1!+2!+3!+4!+…+n!,请注意,n<=50。 n!=nx(n-1)x(n-2)x…x1,如:5!=5x4x3x2x1=120。 c++ using namespace std;要有 不要注释 使用高精度算法(439点数解答 | 2025-09-26 19:33:39)6
- 求2+2 * 2+2 * 2 * 2+…+2 * 2 * 2 *…. * 2的和是多少?最后一项有多少 2 相乘由键盘读入的 n 决定(1<=n<=100)! 比如:n=3,那么s=2+2 * 2 + 2 * 2 * 2 = 14!c++ using namespace std;要有 不要注释 使用高精度算法(441点数解答 | 2025-09-26 19:35:18)5
- 求2的n次方!(0<=n<=100)c++ using namespace std;要有 不要注释 使用高精度算法(253点数解答 | 2025-09-26 19:41:27)9
- #include <random> #include <ctime> using namespace std; #include <opencv2\\opencv.hpp> #include <opencv2\\features2d.hpp> using namespace cv; vector<point2f> pts; // 代码生成的点 const point2f center(200, 200); // 圆心 const float std_r = 100; // 标准半径 // 从 [0, 360) 生成圆周上的点, 都是利用 pt_start 旋转, 再加上一点随机偏移 for (int i = 0; i < 360; i += 8) { default_random_engine e(time(nullptr) + rand()); // 随机 engine uniform_real_distribution<float> u(-8.0f, 8.0f); const float r = std_r + u(e); // 半径 + 误差(29点数解答 | 2024-11-06 23:40:42)169
- #include<iostream> using namespace std; int a[305],b[305],c[305]; string a1,b2; int la,lb,lc; int main(){ cin>>a1>>b1; la=a1.size(); lb=b1.size(); for(int i=0;i<la;i++){ a[la-i]=a1[i]-'0'; } for(int i=0;i<lb;i++){ b[lb-i]=b1[i]-'0'; } lc=la+lb+1; for(int i=lc;i>=1;i--){ } } c++ 要加using namespace std; 不要注释 改成高精度减法 (616点数解答 | 2025-09-20 10:52:09)14
- #include<iostream> using namespace std; int a[305],b[305],c[305]; string a1,b2; int la,lb,lc; int main(){ cin>>a1>>b1; la=a1.size(); lb=b1.size(); for(int i=0;i<la;i++){ a[la-i]=a1[i]-'0'; } for(int i=0;i<lb;i++){ b[lb-i]=b1[i]-'0'; } lc=la+lb+1; for(int i=lc;i>=1;i--){ } } 改成高精度除法 c++ 要加using namespace std; 不要注释(719点数解答 | 2025-09-20 10:54:17)12