问题标题: 酷町堂:1382 记事本

0
0
已解决
董子墨
董子墨
中级天翼
中级天翼

1382   记事本

WA 85分代码如下:

#include<iostream>
using namespace std;
int w[101],t=0;
bool pd(int n){
    for(int i=1;i<=t;i++)
        if(w[i]==n)return 1;
    return 0;
}
int main(){
    int n,m,cnt=0,k;
    bool f=0;
    cin>>m>>n;
    while(n--){
        cin>>k;
        if(pd(k))continue;
        if(t==m)t=0;
        w[++t]=k;
        cnt++;
    }
    cout<<cnt;
    return 0;
}

以前回答发的代码和我的思路不一样,请不要发以前的网址!!!


0
已采纳
董宇昊
董宇昊
初级启示者
初级启示者

核心代码:

if(f==0)
    {
      count++;
      a[t]=temp;
      t++;
      if(t-h>m)
        h++;
    }

剩下自己想吧。

0
0
0
0
董子墨
董子墨
中级天翼
中级天翼

谁来回答?

董子墨在2019-11-15 16:58:14追加了内容

人呢?

0
我要回答