标签:style blog http color os strong io 2014
fmod
#include <stdio.h> #include<math.h> int main(int argc, char *argv[]) { float a,b,c; while (scanf("%f %f",&a,&b)) { c=fmod(a,b); printf("%f\n",c); } return 0; }
#include <stdio.h>
#include<math.h>
int main(int argc, char *argv[])
{
float a,b,c;
while (scanf("%f %f",&a,&b))
{
c=fmod(a,b);
printf("%f\n",c);
}
return 0;
}
floor 向下取整
#include <stdio.h> #include<math.h> int main(int argc, char *argv[]) { float a,b,c; while (scanf("%f",&a)) { c=floor(a); printf("%f\n",c); } return 0; }
#include <stdio.h>
#include<math.h>
int main(int argc, char *argv[])
{
float a,b,c;
while (scanf("%f",&a))
{
c=floor(a);
printf("%f\n",c);
}
return 0;
}
ceil 向上取整
#include <stdio.h> #include<math.h> int main(int argc, char *argv[]) { float a,b,c; while (scanf("%f",&a)) { c=ceil(a); printf("%f\n",c); } return 0; }
#include <stdio.h>
#include<math.h>
int main(int argc, char *argv[])
{
float a,b,c;
while (scanf("%f",&a))
{
c=ceil(a);
printf("%f\n",c);
}
return 0;
}
sin正弦函数
#include <stdio.h> #include<math.h> #define PI 3.1415926 int main(int argc, char *argv[]) { float a,c; while (scanf("%f",&a)) { c=sin(a/180*PI); printf("%f\n",c); } return 0; }
#include <stdio.h>
#include<math.h>
#define PI 3.1415926
int main(int argc, char *argv[])
{
float a,c;
while (scanf("%f",&a))
{
c=sin(a/180*PI);
printf("%f\n",c);
}
return 0;
}
四舍五入
#include <stdio.h> #include<math.h> int main(int argc, char *argv[]) { float a,b,c; while (scanf("%f",&a)) { c=floor(a+0.5); printf("%f\n",c); } return 0; }
#include <stdio.h>
#include<math.h>
int main(int argc, char *argv[])
{
float a,b,c;
while (scanf("%f",&a))
{
c=floor(a+0.5);
printf("%f\n",c);
}
return 0;
}
标签:style blog http color os strong io 2014
原文地址:http://www.cnblogs.com/2014acm/p/3887028.html