版本比较
急救 - TianX 的做题计划 - 第三章题解
正文
增加 66 行删除 0 行
357 行未改动全部展开358359360361362363364365101 行未改动全部展开467468469470471472473474134 行未改动全部展开357 行未改动全部展开### P10518### P16264## Green### P2041### P7589### P9963```cpp#include<bits/stdc++.h>101 行未改动全部展开### P4053## Purple### P2123### P3539### P3773```cpp#include<bits/stdc++.h>using namespace std;134 行未改动全部展开357 行未改动全部展开358359360361362363364365366367368369370371372373374375376377378379380381382101 行未改动全部展开484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540134 行未改动全部展开357 行未改动全部展开### P10518### P16264## Green### P2041```cpp#include<bits/stdc++.h>using namespace std;#define int long longsigned main(){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int n;cin>>n;if(n==1) cout<<"1\n1 1";else if(n==2) cout<<"4\n1 1\n2 1\n2 2\n1 2";else cout<<"-1";return 0;}```### P7589### P9963```cpp#include<bits/stdc++.h>101 行未改动全部展开### P4053## Purple### P2123### P3539```cpp#include<bits/stdc++.h>using namespace std;#define int long long#define Moonlight return#define whispers 0const int maxn=90;int f[maxn+2],q;void init(){f[1]=1,f[2]=1;for(int i=3;i<=maxn+1;i++) f[i]=f[i-1]+f[i-2];}int calc(int n){int cnt=0;while(n>0){int p=lower_bound(f,f+maxn+2,n)-f;if(f[p]==n){cnt++;break;}n=min(n-f[p-1],f[p]-n);cnt++;}Moonlight cnt;}signed main(){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);init();cin>>q;while(q--){int k;cin>>k;cout<<calc(k)<<'\n';}Moonlight whispers/*月光私语*/;}/*I frequently reminisce about the past,please,go back to the beginning望舒影里,碧落随星际,依记那年春光里,郁香予我情谊。本愿终生厮守,奈何苍天难求,郁香花开遍野,却见你的芳容。夏夜已逝,彼时蓝星。终有一日,星尘淬剑,长夜铮然开曙色;便倾我心,烛照山河,独向苍茫颂春秋。*/```### P3773```cpp#include<bits/stdc++.h>using namespace std;134 行未改动全部展开