AtCoder Beginner Contest 030

Submission #1675371

Source codeソースコード

#include<iostream>
#include<algorithm>
#include<functional>
#include <string>
#include<iomanip>
#include<cstdio>
#include<math.h>
#include<set>
#include<stack>
#include<map>
#include<queue>
#include<cstring>
#include<vector>
#include<cstdint>
#include <type_traits>
typedef long long int ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}
#define mod 1000000007
#define MIN -93193111451418101
#define INF 931931114518101
using namespace std;
typedef pair<ll, ll>P;
template<typename T, typename U>
std::enable_if_t<std::rank<T>::value == 0> fill_all(T& arr, const U& v) {
    arr = v;
}
template<typename ARR, typename U>
std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR& arr, const U& v) {
    for (auto& i : arr) {
        fill_all(i, v);
    }
}
#define MAX_NUM 50
long long comb[MAX_NUM + 1][MAX_NUM + 1];
 
ll par[100000], depth[100000];
static void calc_comb()
{
    for (uint32_t i = 0; i <= MAX_NUM; i++) {
        for (uint32_t j = 0; j <= i; j++) {
            if ((j == 0) || (i == j)) {
                comb[i][j] = 1;
            }
            else {
                comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];
            }
        }
    }
}
#define yo 100001
typedef pair<ll, double> dop;
 
//------------------変数-----------------------//
ll n,m,t,a,beet[11514];
string k;
vector<ll> izryt;
//-------------------関数----------------------//
 
ll MMMOD (string dividend, ll divisor) {
    ll MOD = 0, N = dividend.size();
    for (int i = 0; i < N; ++i) {
        MOD = (MOD * 10 + (dividend[i] - '0')) % divisor;
    }
    return MOD;
}
 
int main(){
    cin>>n;
    cin>>a;
    cin>>k;
    REP(i,n){
        cin>>beet[i];beet[i]--;
    }
    bool hoge[114514]={};
    ll now=beet[a-1];
    ll start;
    while(1){
 ///       cout<<now<<"a"<<endl;
        if(hoge[now]){
            REP(i,izryt.size()){
                if(izryt[i]==now){ 閉路の開始地点についた場合
                    start=i;
                }
            }
            break;
        }
        hoge[now]=true; 
    
        izryt.push_back(now);
        now=beet[now];
    }
    if(k.size()<10){ある程度の大きさで
        if(stoi(k)-1<start){閉路にたどり着く前の場合
            cout<<izryt[stoi(k)-1]+1<<endl;return 0;
        }
    }
    REP(i,izryt.size()){
  ///  cout<<izryt[i]<<"aaa"<<endl;
    }
   /// cout<<start<<endl;
    ll kei=MMMOD(k,izryt.size()-start);これは、kを閉路の大きさでわり、余りを返している
kei-=start+1;これは閉路にたどり着く前の分を引いている

if(kei<0){kei=izryt.size()-start+kei;}正の数の余りを求めている
   
   
    cout<<izryt[kei+start]+1<<endl;
    
    return 0;
}

Submission

Task問題 A - 勝率計算
User nameユーザ名 keidaroo
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 CE
Score得点 -
Source lengthソースコード長 2916 Byte
File nameファイル名
Exec time実行時間 -
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

./Main.cpp:84:17: error: stray ‘\351’ in program
if(izryt[i]==now){ 閉路の開始地点についた場合
^
./Main.cpp:84:17: error: stray ‘\226’ in program
./Main.cpp:84:17: error: stray ‘\211’ in program
./Main.cpp:84:17: error: stray ‘\350’ in program
./Main.cpp:84:17: error: stray ‘\267’ in program
./Main.cpp:84:17: error: stray ‘\257’ in program
./Main.cpp:84:17: error: stray ‘\343’ in program
./Main.cpp:84:17: error: stray ‘\201’ in program
./Main.cpp:84:17: error: stray ‘\256’ in program
./Main.cpp:84:17: error: stray ‘\351’ in program
./Main.cpp:84:17: error: stray ‘\226’ in program
./Main.cpp:84:17: error: stray ‘\213’ in program
./Main.cpp:84:17: error: stray ‘\345’ in program
./Main.cpp:84:17: error: stray ‘\247’ in program
./Main.cpp:84:17: error: stray ‘\213’ in program
./Main.cpp:84:17: error: stray ‘\345’ in program
./Main.cpp:84:17: error: stray ‘\234’ in program
./Main.cpp:84:17: error: stray ‘\260’ in program
./Main.cpp:84:17: error: stray ‘\347’ in program
./Main.cpp:84:17: error...

Test case