栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

zoj 1058 Currency Exchange

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

zoj 1058 Currency Exchange

#include<stdio.h>double change(double money, int coun1, int coun2, double m[5][5]){    double mon = money*m[coun1][coun2];    long monl = mon*100;    double mon2 = (double)monl/100;    if(mon-mon2>=0.005)    {        mon = mon2+0.01;    }    else        mon = mon2;    return mon;}int main(){    int N;    int trip[1000];    double matrix[5][5];    scanf("%d",&N);    while(N--)    {        for(int i=0;i<5;i++) for(int j=0;j<5;j++) {     scanf("%lf",&matrix[i][j]); }        int num;        double dollor;        scanf("%d",&num);        while(num)        { for(int i=0;i<num;i++) {     scanf("%d",&trip[i]); } trip[num] = 1; scanf("%lf",&dollor); dollor = change(dollor,0,trip[0]-1,matrix); for(int i=0;i<num;i++) {     dollor = change(dollor,trip[i]-1,trip[i+1]-1,matrix); } printf("%.2lfn",dollor); scanf("%d",&num);        }        if(N!=0) printf("n");    }}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/372949.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号