E. Copy and Submit II (推出遞推公式)


#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;/*剛開始被嚇到了,其實很簡單,將遞歸呈現在紙上就很顯然了。*/
typedef long long ll;
const ll M =1000000007;
int main(){
   int n;
   while (scanf("%d",&n)!=EOF) {
       ll temp;
      ll ans=1;
      for(int i=0;i<n;i++){
          scanf("%lld",&temp);
          temp%=M;
          ans+=ans*temp%M;
      }
      printf("%lld\n",ans%M);
   }
    return 0;
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章