Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
大概只有我一个人用拉格朗日插值做的……#include <stdio.h> #include <stdlib.h> #include <string.h> int f(int x1,int y1,int x2,int y2,int x3,int y3,int x); int main(void) { int a,b,c; while(scanf("%d%d%d",&a,&b,&c)!=EOF) { printf("%d %d %d",f(0,a,1,b,2,c,3),f(0,a,1,b,2,c,4),f(0,a,1,b,2,c,5)); } return (0); } int f(int x1,int y1,int x2,int y2,int x3,int y3,int x) { return ((x-x2)*(x-x3)*y1/(x1-x2)/(x1-x3)+(x-x1)*(x-x3)*y2/(x2-x1)/(x2-x3)+(x-x1)*(x-x2)*y3/(x3-x1)/(x3-x2)); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator