河西-7.26上午3教室-廖

· · 个人记录

 ●ω● 

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,ans=0;
    cin>>n;
    while(n--){
        int a,b;
        cin>>a>>b;
        if(b==0){
            ans+=10;
        }else{
            ans+=a;
        }
    }
    cout<<ans;
    return 0;
}

错误点:十年OI一场空,不开long long 见祖宗。(ಥ﹏ಥ)

#include <bits/stdc++.h>
using namespace std;
int main(){
    long long x;
    cin>>x;
    if(x%62==0){
        cout<<"Yes";
        return 0;
    }
    while(x!=0){
        if(x%100==62){
            cout<<"Yes";
            return 0;
        }
        x/=10;
    }
    cout<<"No";
    return 0;
}

错误点:数组开小了(╥╯^╰╥)

#include <bits/stdc++.h>
using namespace std;
int n;
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        char a=(i%26)+'A';
        for(int j=1;j<=n;j++){
            if(a>'Z'){
                a='A';
            }
            cout<<a;
            a++;
        }
        cout<<endl;
    }
    return 0;
}

//€

错误点:没用map┭┮﹏┭┮

#include <bits/stdc++.h>
using namespace std;
map<long long,long long>t;
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        long long x;
        cin>>x;
        t[x]++;
    }
    for(auto i=t.begin();i!=t.end();i++){
        cout<<i->first<<" "<<i->second<<endl;
    }
    return 0;
}

错误点:纯模拟太多细节问题|*´Å`)ノ

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int a[55][55];
int main() {
    int n;
    cin >> n;
    a[1][n / 2 + 1] = 1;
    for (int k = 2; k <= n * n; k++) { 
        for (int  x= 1; x <= n; x++) { 
            for (int y = 1; y <= n; y++) { 
                if (a[x][y] == k - 1) { 
                    if (x == 1 && y != n) {
                        a[n][y + 1] = k;
                    } else if (y == n && x != 1) { 
                        a[x - 1][1] = k;
                    } else if (x == 1 && y == n) {
                        a[x + 1][y] = k;
                    } else if (x != 1 && y != n) {
                        if (a[x - 1][y + 1] == 0) {
                            a[x - 1][y + 1] = k;
                        } else { 
                            a[x + 1][y] = k;
                        }
                    }
                }
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            cout << a[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}

错误点:没写代码◢ д ◣

#include<bits/stdc++.h>
#define ll long long
using namespace std;
double a[10005];
int n, k;
int main() {
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    double l = 0, r = 100001;
    while (l + 0.01 < r) {
        double mid = (l + r) / 2;
        int ans = 0,f=0;
            for (int i = 1; i <= n; i++) {
                ans = ans + a[i] / mid;
            }
            if (ans >= k) {
                f=1;
            }
        if ( f == 1 ) { 
            l = mid;
        }
        else {
            r = mid;
        }
    }
    cout << fixed << setprecision(2) << r;
    return 0;
}

错误点:没写代码(╯︵╰)

#include<bits/stdc++.h>
#define ll long long
using namespace std;
char a[1005][1005];
int z[1005][1005];
int jx[] = {0, 0, 1, -1};
int jy[] = {-1, 1, 0, 0}; 
int t[1000005];
int n, m; 
int ltq;
void dfs(int x, int y) {
    z[x][y] = ltq; 
    for (int i = 0; i < 4; i++) {
        int xx = x + jx[i];
        int yy = y + jy[i];
        if (xx < 1 || yy < 1 || xx > n || y > n) {
            continue;
        }
        if (z[xx][yy] != 0) {
            continue;
        }
        if (a[xx][yy] == a[x][y]) {
            continue;
        }
        dfs(xx, yy);
    }
}
int main() {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (z[i][j] == 0) {
                ltq++;
                dfs(i, j);
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            t[ z[i][j] ]++; 
        }
    }
    while (m--) {
        int x, y;
        cin >> x >> y;
        cout << t[ z[x][y] ] << endl;
    }
    return 0;
}

以上就是我的总结