A题:因为数据量太小,所以直接暴力替换就好。。。。
#include <iostream>#include <algorithm>#include <string>#include <map>#include <vector>#include <string.h>using namespace std;typedef long long ll;int arr[100010];int cnt[100010];int col[100010];int n,a,b;char c;string s = "qwertyuiopasdfghjkl;zxcvbnm,./";int main(){ while(cin>>c) { string input; cin>>input; if(c=='L') { string output=""; for(int i=0;i<input.length for j="0;j<s.length();j++)" if output break cout else string i="0;i<input.length();i++)" return> <br> B题:数据只有100000,故可以直接用一个map记录每个点所在的区间标识。 <p></p> <p></p> <pre name="code" class="sycode">#include <iostream>#include <algorithm>#include <string>#include <map>#include <vector>#include <string.h>using namespace std;typedef long long ll;int arr[100010];int cnt[100010];int col[100010];int n,a,b;char c;string s = "qwertyuiopasdfghjkl;zxcvbnm,./";int main(){ while(cin>>n) { int all = 0; map<int> m; for(int i=1;i>arr[i]; for(int j=all+1;j>k; for(int i=0;i<k int q cin>>q; cout <br> C题:直接暴力枚举旋转的可能性,因为每个点最多转3次,最后判断是不是正方形就行。 <p></p> <p></p> <pre name="code" class="sycode">#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> const int inf=9999999; using namespace std; struct node { int x; int y; }p[5][5],home[5]; long long d[8]; long long dis(node a,node b)//距离的平方 { return (long long)(a.x-b.x)*(a.x-b.x)+(long long)(a.y-b.y)*(a.y-b.y); } void solve() { int ans=inf; for(int i=0;i <br> D题:用dp[i][0]表示第i位不是W,dp[i][1]表示第i位是W,这样转移方程就很容易出来了,具体见代码,记得dp[0]时的初始化 <p></p> <p></p> <pre name="code" class="sycode">#include <iostream>#include <algorithm>#include <string>#include <map>#include <vector>#include <string.h>using namespace std;typedef long long ll;ll dp[100010][2];ll sum[100010];int cnt[100010];int col[100010];int n,a,b,t,k;const int mod = 1e9+7;char c;string s = "qwertyuiopasdfghjkl;zxcvbnm,./";int main(){ while(cin>>t>>k) { memset(dp,0,sizeof(dp)); dp[0][0]=1; dp[0][1]=0; for(int i=1;i=0) { dp[i][1] = (dp[i][1]+dp[i-k][0]+dp[i-k][1])%mod; } } sum[0] = 0; for(int i=1;i>a>>b; ll ans = sum[b]-sum[a-1]; if(ans <br> <br> <p></p> </string.h></vector></map></string></algorithm></iostream>