CF #329 C
C题我还以为是拉格朗日插值。。。
其实可以想象到,必须有这样一个函数,经过某一点时,其它圆相关的函数要为0。
于是,可以构造这样的一个函数,对于x有 (x/2)*(1-abs(t-i)+abs(1-abs(t-i)))
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <cstring> #include <string> #include <cmath> #include <set> #include <map> using namespace std; #define LL __int64 #define PB push_back #define P pair<int, int> #define X first #define Y second const int N = 55; P a[N]; int main() { int n; scanf ( "%d" , &n); int r; for ( int i = 0; i < n; ++i) { scanf ( "%d%d%d" , &a[i].X, &a[i].Y, &r); } string left = "(((1-abs((t-" , mid = ")))+abs((abs((t-" , right = "))-1)))" ; string ans1 = "" ; string ans2 = "" ; for ( int i = 0; i < n - 1; ++i) { ans1 += "(" ; ans2 += "(" ; } for ( int i = 0; i < n; ++i) { string num = to_string(i); ans1 += left + num + mid + num + right + "*" + to_string(a[i].X / 2) + ")" ; ans2 += left + num + mid + num + right + "*" + to_string(a[i].Y / 2) + ")" ; if (i != 0) ans1 += ")" , ans2 += ")" ; if (i != n - 1) ans1 += "+" , ans2 += "+" ; } cout<<ans1<<endl; cout<<ans2<<endl; return 0; } |
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步