如果发现广告等破坏行为,请尽量将条目恢复到较早的版本而不是把相应内容直接删除,谢谢合作。

URAL/1581

来自"NOCOW"

跳转到: 导航, 搜索
#include <iostream>
using namespace std;
int n,x,tot,last;
int main()
{
    cin >> n;
    for (int i=1;i<=n;++i)
    {
        cin >> x;
        if (i == 1)
        {
            last=x;
            tot=1;
        }
        else if (last == x)
            ++tot;
        else
        {
            cout << tot << ' ' << last << ' ';
            tot=1;
            last=x;
        }
    }
    cout << tot << ' ' << last << endl;
    return 0;
}
//by zzy
个人工具