由于考试复习繁忙,具体题解思路暂未更新给出,非常抱歉。
这里先给出题目标程,稍后有空闲时间会更新题解思路。

A:

#include <bits/stdc++.h>
using namespace std;
set <char> st;
string s;
int main()
{
    cin>>s;
    for(int i=0;i<s.size();i++) st.insert(s[i]);
    cout<<st.size()<<endl;
}

B:

Python:

n=int(input())
if n&1 : print 1
else : print 2

C++:

#include <bits/stdc++.h>
using namespace std;
string s;
int main()
{
    cin>>s;
    int n=s[s.size()-1]-’0’;
    if(n&1) printf("1\n");
    else printf("2\n");
}

C:

#include <bits/stdc++.h>
using namespace std;
#define N 30
long long a[N]; 
long long b[N];
long long gcd(long long a,long long b)
{
    return b==0?a:gcd(b,a%b);
}
int main() {
    long long t,m;
    scanf("%lld",&t);
    while(t--)
    {
        scanf("%lld", &m);
        a[1] = 0; a[2] = 1;
        b[1] = 1; b[2] = 2;
        for (int i = 3; i <= m; i++) 
        {
            a[i] = (i - 1) * (a[i - 1] + a[i - 2]);         
            b[i] = b[i - 1] * i;
        }
        long long p=gcd(a[m],b[m]);
        printf("%lld/%lld\n",a[m]/p,b[m]/p);
    }
}

D:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod=1e9+7;
ll qpow(ll base,ll power)
{
    ll res=1;
    while(power)
    {
        if(power&1) res=res*base%mod;
        base=base*base%mod;
        power>>=1;
    }
    return res%mod;
}
int main()
{
    ll n;
    scanf("%lld",&n);
    printf("%lld\n",(qpow(2,n)-1+mod)%mod);
}

E:

#include<fstream> 
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cstdio>
#define oo 1147483647
using namespace std;
int m,n;
int a[100010],tt,ans;
int cmp(const void *a,const void *b)
{
    return *(int *)a-*(int *)b;
}
int main()
{
    //freopen("orz.in","r",stdin);
    //freopen("orz.out","w",stdout);
    int i;
    scanf("%d",&n);
    for (i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    a[n+1]=1<<29;
    a[0]=-oo;
    qsort(a+1,n,sizeof(int),cmp);
    scanf("%d",&m);
    int x1,x2,y1,y2;
    for (i=1;i<=m;i++)
    {
        scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
        ans=0;
        if ((y1>0&&y2>0)||(y1<0&&y2<0))
        {
            ans=(int)abs((double)(y1-y2))+(int)abs((double)(x1-x2));
            printf("%d\n",ans);
            continue;
        }
        if (x1>x2) swap(x1,x2);
        ans=oo;
        int l=1,r=n,mid;
        while (l<=r)
        {
              mid=(l+r)>>1;
              if (a[mid]>=x1 && a[mid-1]<x1) 
              {
                  if (ans>(a[mid]-x1+abs(a[mid]-x2))) ans=a[mid]-x1+abs(a[mid]-x2);
                  if (mid>1) if (ans>(x1-a[mid-1]+abs(a[mid-1]-x2))) ans=x1-a[mid-1]+abs(a[mid-1]-x2);
                  break;
              }
              if (a[mid]<x1) l=mid+1;
              if (a[mid]>x1) r=mid-1;
        }
        l=1;r=n;mid;
        while (l<=r)
        {
              mid=(l+r)>>1;
              if (a[mid]<=x2 && a[mid+1]>x2) 
              {
                      if (ans>(x2-a[mid]+abs(x1-a[mid]))) ans=x2-a[mid]+abs(x1-a[mid]);
                      if ((mid+1)<=n)if (ans>(a[mid+1]-x2+abs(x1-a[mid+1]))) ans=a[mid+1]-x2+abs(x1-a[mid+1]);
                      break;
              }
              if (a[mid]<x2) l=mid+1;
              if (a[mid]>x2) r=mid-1;
        }
        ans+=(int)abs((double)(y1-y2));
        printf("%d\n",ans);
    }
    return 0;
}

F:

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
#define int long long
long long f[500100];
bool b[500100];
signed main()
{
    int n;
    while (scanf("%lld", &n) != EOF)
    {
        memset(b, 0, sizeof(b));
        for (int i = 1; i <= n; i++) f[i] = i;
        for (int i = 2; i <= n; i++)
        {
            if (b[i]) continue;

            for (int j = i; j <= n; j += i)
            {
                f[j] = (f[j] / i) * (i - 1);
                b[j] = 1;
            }
        }
        int re = 1;
        for (int i = 2; i <= n; i++)
        {
            re += f[i] * 2;
        }
        printf("%lld\n", re + 2);
    }
    return 0;
}

G:

#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
#define ll long long
const ll INF = 9999999999999;
ll n, sta;
const int N = 1010;
ll ans = 0;
struct node
{
    ll x, c, d;
    bool operator < (const node& rhs)
    {
        return abs(x) < abs(rhs.x);
    }
}L[N],R[N];
ll f[N][N][2];
ll sumL[N], sumR[N];
int main()
{
    scanf("%lld%lld", &n, &sta);
    int topL = 0, topR = 0;
    L[0].x = 0, R[0].x = 0;
    ans = 0;
    memset(sumL, 0, sizeof(sumL)); memset(sumR, 0, sizeof(sumR));
    for (int i = 1; i <= n; i++)
    {
        ll x, c, d;
        scanf("%lld%lld%lld", &x, &c, &d);
        if (x > sta)
        {
            R[++topR].x = x - sta;
            R[topR].c = c;
            R[topR].d = d;
        }
        else if (x < sta)
        {
            L[++topL].x = x - sta;
            L[topL].c = c;
            L[topL].d = d;
        }
        ans += c;
    }
    sort(L + 1, L + 1 + topL);
    sort(R + 1, R + 1 + topR);
    for (int i = 1; i <= topL; i++)
    {
        sumL[i] = sumL[i - 1] + L[i].d;
    }
    for (int i = 1; i <= topR; i++)
    {
        sumR[i] = sumR[i - 1] + R[i].d;
    }
    for (int i = 1; i <= topL; i++)
    {
        f[i][0][0] = f[i - 1][0][0] + abs(L[i].x - L[i - 1].x) * (sumL[topL] - sumL[i - 1] + sumR[topR]);
    }
    for (int i = 1; i <= topR; i++)
    {
        f[0][i][1] = f[0][i - 1][1] + abs(R[i].x - R[i - 1].x) * (sumR[topR] - sumR[i - 1] + sumL[topL]);
    }
    for (int i = 1; i <= topL; i++)
    {
        for (int j = 1; j <= topR; j++)
        {
            //i是新到的点
            f[i][j][0] = min( (i==1?INF:(f[i - 1][j][0] + (abs(L[i].x - L[i - 1].x) * (sumL[topL] - sumL[i - 1] + sumR[topR] - sumR[j])))),
                f[i - 1][j][1] + (abs(L[i].x - R[j].x) * (sumL[topL] - sumL[i - 1] + sumR[topR] - sumR[j])) );
            //j是新到的点
            f[i][j][1] = min( (f[i][j - 1][0] + (abs(L[i].x - R[j].x) * (sumL[topL] - sumL[i] + sumR[topR] - sumR[j-1]))),
                j==1?INF:(f[i][j - 1][1] + (abs(R[j].x - R[j - 1].x) * (sumL[topL] - sumL[i] + sumR[topR] - sumR[j-1]))) );
        }
    }
    printf("%lld\n", ans + ( min(topR==0?INF:f[topL][topR][1], topL==0?INF:f[topL][topR][0])) );
}

H:

#include <bits/stdc++.h>
using namespace std;
#define MAX 247

int M,N;

int A[MAX][MAX];

int R[MAX][MAX];
int C[MAX][MAX];

int G[MAX*MAX][2];
int PR[MAX*MAX]; 
int PC[MAX*MAX];

int r,c;

int augment()
{
  int buf[MAX*MAX];
  int S[MAX*MAX];
  int zbuf, kbuf;
  int i, found, v, vb, va, tmp;
  int x;

  zbuf = kbuf = 0;
  for(i = 0; i < c; i++) S[i] = -1;
  for(i = 0; i < r; i++)
    if (PR[i] < 0) buf[kbuf++] = i;
  found = 0;
  while (zbuf < kbuf && !found) {
    v = buf[zbuf++];
    x = G[v][1];
    for(x=G[v][1]; x<N && A[G[v][0]][x]!=2; x++)
      if (A[G[v][0]][x]==0) {
        vb=C[G[v][0]][x];
        if (S[vb] < 0 && PC[vb] != v) {
          S[vb] = v;
          if (PC[vb] < 0) {
            found = 1;
            while (vb >= 0) {
              va = S[vb];
              tmp = PR[va];
              PR[va] = vb;
              PC[vb] = va;
              vb = tmp;
            }
            break;
          }
          buf[kbuf++] = PC[vb];
        }
      }
  }
  return found;
}


int main()
{
  int i,j,m,x;
  scanf("%d %d",&M,&N);
  for (i=0;i<M;i++) 
    for (j=0;j<N;j++)
      scanf("%d",&A[i][j]);
  c=0;
  for (j=0;j<N;j++) {
    for (i=0;i<M;i++) {
      if (A[i][j]==2) c++;
      else C[i][j]=c; 
    }
    c++;
  }
  r=0;
  for (i=0;i<M;i++) {
    G[r][0]=i; G[r][1]=0;
    for (j=0;j<N;j++) {
      if (A[i][j]==2) {r++; G[r][0]=i; G[r][1]=j+1;}
      else R[i][j]=r; 
    }
    r++;
  }

  for (i = 0; i < r; i++) PR[i] = -1;
  for (i = 0; i < c; i++) PC[i] = -1;
  for (m = 0; augment(); m++);

  printf("%d\n",m);         
  return 0;
}

I:

#include<stdio.h>
#include<string.h>

int sum[300001];
int max0[300001];
int max1[300001];
int left0[300001];
int right0[300001];
int left1[300001];
int right1[300001];
bool b[300001];
int z[300001];
int a[100001];

void updata(int x,int l,int m,int h)
{
    b[x]=true;
    sum[x]=sum[2*x]+sum[2*x+1];
    max1[x]=max1[2*x];
    if (max1[x]<max1[2*x+1]) max1[x]=max1[2*x+1];
    if (max1[x]<right1[2*x]+left1[2*x+1]) max1[x]=right1[2*x]+left1[2*x+1];
    max0[x]=max0[2*x];
    if (max0[x]<max0[2*x+1]) max0[x]=max0[2*x+1];
    if (max0[x]<right0[2*x]+left0[2*x+1]) max0[x]=right0[2*x]+left0[2*x+1];
    if (left1[2*x]==m-l+1) left1[x]=left1[2*x]+left1[2*x+1];
    else left1[x]=left1[2*x];
    if (right1[2*x+1]==h-m) right1[x]=right1[2*x]+right1[2*x+1];
    else right1[x]=right1[2*x+1];
    if (left0[2*x]==m-l+1) left0[x]=left0[2*x]+left0[2*x+1];
    else left0[x]=left0[2*x];
    if (right0[2*x+1]==h-m) right0[x]=right0[2*x]+right0[2*x+1];
    else right0[x]=right0[2*x+1];
    if (z[2*x]==z[2*x+1]) z[x]=z[2*x];
    else z[x]=2;
}

void change2(int x,int l,int h,int dd)
{
    int s0,s1;
    if (dd==0)
    {
        s0=h-l+1;
        s1=0;
    }
    else
    {
        s0=0;
        s1=h-l+1;
    }
    sum[x]=s1;
    max0[x]=s0;
    left0[x]=s0;
    right0[x]=s0;
    max1[x]=s1;
    left1[x]=s1;
    right1[x]=s1;
    z[x]=dd;
    b[x]=false;
}

void change(int x,int l,int h)
{
    if (z[x]<=1) change2(x,l,h,1-z[x]);
    else
    {
        b[x]=!b[x];
        int pp;
        pp=max1[x];
        max1[x]=max0[x];
        max0[x]=pp;
        pp=left1[x];
        left1[x]=left0[x];
        left0[x]=pp;
        pp=right1[x];
        right1[x]=right0[x];
        right0[x]=pp;
        sum[x]=h-l+1-sum[x];
    }
}

void datadown(int x,int l,int m,int h)
{
    if (b[x]) return;
    if (z[x]<=1)
    {
        change2(2*x,l,m,z[x]);
        change2(2*x+1,m+1,h,z[x]);
    }
    else
    {
        change(2*x,l,m);
        change(2*x+1,m+1,h);
    }
    b[x]=true;
}

void build(int x,int l,int h)
{
    if (l==h) change2(x,l,h,a[l]);
    else
    {
        int m=(l+h)/2;
        build(2*x,l,m);
        build(2*x+1,m+1,h);
        updata(x,l,m,h);
    }
}

void insert(int x,int l,int h,int ll,int hh,int dd)
{
    if (l==ll&&h==hh)
    {
        if (dd<=1) change2(x,l,h,dd);
        else change(x,l,h);
    }
    else
    {
        int m=(l+h)/2;
        datadown(x,l,m,h);
        if (hh<=m) insert(2*x,l,m,ll,hh,dd);
        else
        {
            if (ll<=m) 
            {
                insert(2*x,l,m,ll,m,dd);
                insert(2*x+1,m+1,h,m+1,hh,dd);
            }
            else insert(2*x+1,m+1,h,ll,hh,dd);
        }
        updata(x,l,m,h);
    }
}

int query0(int x,int l,int h,int ll,int hh)
{
    if (l==ll&&h==hh) return sum[x];
    else
    {
        int m=(l+h)/2;
        datadown(x,l,m,h);
        if (hh<=m) return query0(2*x,l,m,ll,hh);
        else
            if (ll<=m) return query0(2*x,l,m,ll,m)+query0(2*x+1,m+1,h,m+1,hh);
            else return query0(2*x+1,m+1,h,ll,hh);
    }
}

int query1(int x,int l,int h,int ll,int hh)
{
    if (l==ll&&h==hh) return max1[x];
    else
    {
        int m=(l+h)/2;
        datadown(x,l,m,h);
        if (hh<=m) return query1(2*x,l,m,ll,hh);
        else
        {
            if (ll<=m)
            {
                int m1=query1(2*x,l,m,ll,m);
                int m2=query1(2*x+1,m+1,h,m+1,hh);
                int mm;
                if (m1>m2) mm=m1;
                else mm=m2;
                int r1,l1;
                if (right1[2*x]>m-ll+1) r1=m-ll+1;
                else r1=right1[2*x];
                if (left1[2*x+1]>hh-m) l1=hh-m;
                else l1=left1[2*x+1];
                if (mm>r1+l1) return mm;
                else return r1+l1;
            }
            else return query1(2*x+1,m+1,h,ll,hh);
        }
    }
}

int main()
{
    int n;
    int t,p;
    int i;
    int op,b,c;
    //freopen("operation.in","r",stdin);
    //freopen("operation.out","w",stdout);
    scanf("%d%d",&n,&t);
    for (i=0;i<n;i++)
        scanf("%d",&a[i]);
    build(1,0,n-1);
    for (p=1;p<=t;p++)
    {
        scanf("%d",&op);
        scanf("%d%d",&b,&c);
        if (op==0) insert(1,0,n-1,b,c,0);
        if (op==1) insert(1,0,n-1,b,c,1);
        if (op==2) insert(1,0,n-1,b,c,2);
        if (op==3) printf("%d\n",query0(1,0,n-1,b,c));
        if (op==4) printf("%d\n",query1(1,0,n-1,b,c));
    }
    fclose(stdin);
    fclose(stdout);
    return 0;
}