当前位置: 首页 > news >正文

十月末补充(?

出租车计价:

#include <stdio.h>
int main()
{int x,m,y;double z;scanf("%d",&x);scanf("%d",&m);if(x>0&&x<=3){y=10;}else if((x-3)>0&&(x-3)<=10){y=10+2*(x-3);}else if(x>13){y=3*(x-13)+10+2*10;}else{return 1;}if(m>=5){z=(m/5.0)*2.0;}else{z=0.0;}double fee=y+z;             //注意把z、fee写成double类型的 才好四舍五入printf("%.0f",fee);return 0;
}
/*
#include <stdio.h>int countdigit(int num, int digit);int main() 
{int n;scanf("%d", &n);int count = assistant(n, 2);printf("%d", count);return 0;
}int digit(int num, int digit) 
{int count = 0;if (num == 0 && digit == 0) {return 1; }while (num > 0) {int last = num % 10;if (last == digit) {count++;}num /= 10; }return count;
}
*//*
#include <stdio.h>double real,imag;    //全局变量
void prod(double real1,double imag1,double real2,double imag2);
void add(double real1,double imag1,double real2,double imag2);
int main()
{double real1,real2,imag1,imag2;scanf("%lf %lf",&real1,&imag1);scanf("%lf %lf",&real2,&imag2);add(real1,imag1,real2,imag2);printf("%.2f+%.2fi\n",real,imag);prod(real1,imag1,real2,imag2);printf("%.2f+%.2fi\n",real,imag);return 0;
}void prod(double real1,double imag1,double real2,double imag2)
{real=real1*real2-imag1*imag2;imag=real1*imag2+real2*imag1;return;
}
void add(double real1,double imag1,double real2,double imag2)
{real=real1+real2;imag=imag1+imag2;return;
}
*//*
#include <stdio.h>
int main()
{int choice;double cash=0.0;double value;void income(double number,double cash),explend(double number,double cash);scanf("%d",&choice);if(choice!=0){if(choice==1||choice==2){scanf("%lf",&value);if(choice==1){income(value);}else{expend(value);}printf("%.2f",cash);scanf("%d",&choice);}else(choice==0){return 1;}}return 0;} void income(double number,double cash)
{return (cash+=number);
}
void explend(double number,double cash)
{return (cash-=number);
}
*//*
#include <stdio.h>
int main()
{char ch;ch=getchar();while(ch!='\n'){if(ch>='A'&&ch<='Z'){ch=ch-'A'+'a';}else if(ch>='a'&&ch<='z'){ch=ch-'a'+'A';}putchar(ch);ch=getchar();}}return 0;
} #include <stdio.h>
int main()
{char ch;while((ch=getchar())!=EOF){if(ch>='A'&&ch<='Z'){ch=ch-'A'+'a';}else if (ch>='a'&&ch<='z'){ch=ch-'a'+'A';}putchar(ch);}}return 0;
} 
*//*
#include <stdio.h>
int main()
{int word,count;char ch;word=count=0;while((ch=getchar())!=EOF){if(ch==' '){word=0;}else if(word==0){word=1;count++;}}printf("%d",count);return 0;
}*/#include <stdio.h>
#include <math.h>double distance(double x1,double x2,double y1,double y2)
{double dist;dist = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));return dist;
}int main()
{double x1,y1,x2,y2;scanf("%lf %lf",&x1,&y1);scanf("%lf %lf",&x2,&y2);double dist=distance(x1,x2,y1,y2);printf("%.2f",dist);return 0;
}

http://www.mrgr.cn/news/66351.html

相关文章:

  • stm32使用串口的轮询模式,实现数据的收发
  • CSS基础知识六(浮动的高度塌陷问题及解决方案)
  • 软设师知识点-计算机网络
  • 无人机之中继通信技术篇
  • 达梦数据库和人大金仓数据库对数据库的运行查看情况
  • VNS算法求解TSP问题
  • 李沐Softmax回归从零开始实现代码中的关于y和y_hat
  • 牛客网剑指Offer-树篇-JZ36 二叉搜索树与双向链表
  • web——[ACTF2020 新生赛]Exec1——命令注入
  • Spring cloud
  • 探索Java与C++中的类成员访问修饰符:从默认设置到封装实践
  • K8S简单部署,以及UI界面配置
  • 2024年Q3企业邮箱安全性研究报告:钓鱼邮件攻击同比上涨102.3%
  • 揭秘rust中默认参数类型不为人知的秘密,你确定不来了解下吗?
  • 华为 HarmonyOS NEXT 原生应用开发: 动画的基础使用(属性、显示、专场)动画
  • 从零开始的LeetCode刷题日记:746. 使用最小花费爬楼梯
  • 十月末
  • Nginx配置文件编写示例
  • Java中查找与排序算法探究
  • 阿里云服务器 篇十(加更):自动定时备份CSDN博客内容:优化内存和解决图片展示等问题
  • 5分钟上手 Kubernetes:精简实用的 Kubectl 命令速查宝典!
  • 【ESP32+MicroPython】热点模式及网页控制
  • 产品增长之付费推广
  • 光伏设计软件如何快速上手?
  • 【万字详文介绍】:迭代扩张卷积神经网络(IDCNN)
  • 模拟实现C库函数~