• PDLOJ
  • Trang chủ
  • bài tâp
  • Các bài nộp
  • Thành viên
    >
    • Tổ chức
  • Các kỳ thi
  • Thông tin
    >
    • Máy chấm
    • Custom Checkers
    • github
VI EN Đăng nhập  hoặc  Đăng ký

Thecode

  • Thông tin
  • Thống kê
  • Blog

Số bài đã giải: 94
Hạng điểm: #122
Tổng điểm: 58,93
Đóng góp: -10

Xem các bài nộp

Thông tin

3: 593cpp.cpp: In function ‘int main()’: 593cpp.cpp:9:5: warning: statement has no effect [-Wunused-value] 9 | for(s1; s1!=NULL; ++s1) | ^~ 593cpp.cpp:9:11: error: no match for ‘operator!=’ (operand types are ‘std::string’ {aka ‘std::__cxx11::basic_string\<char>’} and ‘long int’) 9 | for(s1; s1!=NULL; ++s1) | ^ In file included from /usr/include/c++/13/iosfwd:42, from /usr/include/c++/13/ios:40, from /usr/include/c++/13/ostream:40, from /usr/include/c++/13/iostream:41, from 593cpp.cpp:1: /usr/include/c++/13/bits/postypes.h:197:5: note: candidate: ‘template<class _StateT> bool std::operator!=(const fpos\<_StateT>&, const fpos\<_StateT>&)’ 197 | operator!=(const fpos\<_StateT>& __lhs, const fpos\<_StateT>& __rhs) | ^~~~ /usr/include/c++/13/bits/postypes.h:197:5: note: template argument deduction/substitution failed: In file included from /usr/include/stdio.h:33, from /usr/include/c++/13/cstdio:42, from /usr/include/c++/13/ext/stringconversions.h:45, from /usr/include/c++/13/bits/basicstring.h:4097, from /usr/include/c++/13/string:54, from /usr/include/c++/13/bits/localeclasses.h:40, from /usr/include/c++/13/bits/iosbase.h:41, from /usr/include/c++/13/ios:44: 593cpp.cpp:9:13: note: ‘std::string’ {aka ‘std::cxx11::basicstring<char>’} is not derived from ‘const std::fpos<_StateT>’ 9 | for(s1; s1!=NULL; ++s1) | ^~ In file included from /usr/include/c++/13/string:43: /usr/include/c++/13/bits/allocator.h:245:5: note: candidate: ‘template<class _T1, class _T2> bool std::operator!=(const allocator\<_CharT>&, const allocator\<_T2>&)’ 245 | operator!=(const allocator\<_T1>&, const allocator\<_T2>&) | ^~ /usr/include/c++/13/bits/allocator.h:245:5: note: template argument deduction/substitution failed: 593cpp.cpp:9:13: note: ‘std::string’ {aka ‘std::cxx11::basicstring<char>’} is not derived from ‘const std::allocator<_CharT>’ 9 | for(s1; s1!=NULL; ++s1) | ^~ In file included from /usr/include/c++/13/string:48: /usr/include/c++/13/bits/stl_iterator.h:462:5: note: candidate: ‘template<class _Iterator> bool std::operator!=(const reverse_iterator\<_Iterator>&, const reverse_iterator\<_Iterator>&)’ 462 | operator!=(const reverse_iterator\<_Iterator>& __x, | ^~ /usr/include/c++/13/bits/stliterator.h:462:5: note: template argument deduction/substitution failed: 593cpp.cpp:9:13: note: ‘std::string’ {aka ‘std::cxx11::basicstring<char>’} is not derived from ‘const std::reverseiterator<_Iterator>’ 9 | for(s1; s1!=NULL; ++s1) | ^~ /usr/include/c++/13/bits/stl_iterator.h:507:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> bool std::operator!=(const reverse_iterator\<_Iterator>&, const reverse_iterator\<_IteratorR>&)’ 507 | operator!=(const reverse_iterator\<_IteratorL>& __x, | ^~ /usr/include/c++/13/bits/stliterator.h:507:5: note: template argument deduction/substitution failed: 593cpp.cpp:9:13: note: ‘std::string’ {aka ‘std::cxx11::basicstring<char>’} is not derived from ‘const std::reverseiterator<_Iterator>’ 9 | for(s1; s1!=NULL; ++s1) | ^~ /usr/include/c++/13/bits/stl_iterator.h:1697:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> bool std::operator!=(const move_iterator\<_IteratorL>&, const move_iterator\<_IteratorR>&)’ 1697 | operator!=(const move_iterator\<_IteratorL>& __x, | ^~ /usr/include/c++/13/bits/stliterator.h:1697:5: note: template argument deduction/substitution failed: 593cpp.cpp:9:13: note: ‘std::string’ {aka ‘std::cxx11::basicstring<char>’} is not derived from ‘const std::moveiterator<_IteratorL>’ 9 | for(s1; s1!=NULL; ++s1) | ^~ /usr/include/c++/13/bits/stl_iterator.h:1763:5: note: candidate: ‘template<class _Iterator> bool std::operator!=(const move_iterator\<_IteratorL>&, const move_iterator\<_IteratorL>&)’ 1763 | operator!=(const move_iterator\<_Iterator>& __x, | ^~ /usr/include/c++/13/bits/stliterator.h:1763:5: note: template argument deduction/substitution failed: 593cpp.cpp:9:13: note: ‘std::string’ {aka ‘std::cxx11::basicstring<char>’} is not derived from ‘const std::moveiterator<_IteratorL>’ 9 | for(s1; s1!=NULL; ++s1) | ^~ In file included from /usr/include/c++/13/bits/stl_algobase.h:64, from /usr/include/c++/13/string:51: /usr/include/c++/13/bits/stl_pair.h:842:5: note: candidate: ‘template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)’ 842 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~ /usr/include/c++/13/bits/stlpair.h:842:5: note: template argument deduction/substitution failed: 593cpp.cpp:9:13: note: ‘std::string’ {aka ‘std::cxx11::basicstring<char>’} is not derived from ‘const std::pair<T1, _T2>’ 9 | for(s1; s1!=NULL; ++s1) | ^~ /usr/include/c++/13/bits/basic_string.h:3776:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3776 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~ /usr/include/c++/13/bits/basicstring.h:3776:5: note: template argument deduction/substitution failed: 593cpp.cpp:9:13: note: mismatched types ‘const std::cxx11::basicstring<CharT, Traits, _Alloc>’ and ‘long int’ 9 | for(s1; s1!=NULL; ++s1) | ^~ /usr/include/c++/13/bits/basic_string.h:3790:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3790 | operator!=(const _CharT* __lhs, | ^~ /usr/include/c++/13/bits/basicstring.h:3790:5: note: template argument deduction/substitution failed: 593cpp.cpp:9:13: note: mismatched types ‘const CharT*’ and ‘std::cxx11::basicstring<char>’ 9 | for(s1; s1!=NULL; ++s1) | ^~ /usr/include/c++/13/bits/basic_string.h:3803:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)’ 3803 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~ /usr/include/c++/13/bits/basicstring.h:3803:5: note: template argument deduction/substitution failed: 593cpp.cpp:9:13: note: mismatched types ‘const _CharT*’ and ‘long int’ 9 | for(s1; s1!=NULL; ++s1) | ^~ In file included from /usr/include/c++/13/bits/locale_facets.h:48, from /usr/include/c++/13/bits/basic_ios.h:37, from /usr/include/c++/13/ios:46: /usr/include/c++/13/bits/streambuf_iterator.h:242:5: note: candidate: ‘template<class _CharT, class _Traits> bool std::operator!=(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)’ 242 | operator!=(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~ /usr/include/c++/13/bits/streambufiterator.h:242:5: note: template argument deduction/substitution failed: 593cpp.cpp:9:13: note: ‘std::string’ {aka ‘std::cxx11::basicstring<char>’} is not derived from ‘const std::istreambufiterator<CharT, _Traits>’ 9 | for(s1; s1!=NULL; ++s1) | ^~ In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/c++allocator.h:33, from /usr/include/c++/13/bits/allocator.h:46: /usr/include/c++/13/bits/new_allocator.h:218:9: note: candidate: ‘template<class _Up> bool std::operator!=(const __new_allocator\<char>&, const __new_allocator\<_Tp>&)’ 218 | operator!=(const __new_allocator&, const __new_allocator\<_Up>&) | ^~ /usr/include/c++/13/bits/newallocator.h:218:9: note: template argument deduction/substitution failed: 593cpp.cpp:9:13: note: mismatched types ‘const std::newallocator<_Tp>’ and ‘long int’ 9 | for(s1; s1!=NULL; ++s1) | ^~ In file included from /usr/include/c++/13/bits/ios_base.h:46: /usr/include/c++/13/system_error:525:3: note: candidate: ‘bool std::operator!=(const error_code&, const error_code&)’ 525 | operator!=(const error_code& __lhs, const error_code& __rhs) noexcept | ^~ /usr/include/c++/13/systemerror:525:32: note: no known conversion for argument 1 from ‘std::string’ {aka ‘std::cxx11::basicstring<char>’} to ‘const std::errorcode&’ 525 | operator!=(const errorcode& lhs, const errorcode& _rhs) noexcept | ~~~~^~~ /usr/include/c++/13/systemerror:530:3: note: candidate: ‘bool std::operator!=(const errorcode&, const errorcondition&)’ 530 | operator!=(const errorcode& _lhs, const errorcondition& _rhs) noexcept | ^~~~ /usr/include/c++/13/system_error:530:32: note: no known conversion for argument 1 from ‘std::string’ {aka ‘std::__cxx11::basic_string\<char>’} to ‘const std::error_code&’ 530 | operator!=(const error_code& __lhs, const error_condition& __rhs) noexcept | ~~~~^~~ /usr/include/c++/13/system_error:535:3: note: candidate: ‘bool std::operator!=(const error_condition&, const error_code&)’ 535 | operator!=(const error_condition& __lhs, const error_code& __rhs) noexcept | ^~~~ /usr/include/c++/13/systemerror:535:37: note: no known conversion for argument 1 from ‘std::string’ {aka ‘std::cxx11::basicstring<char>’} to ‘const std::errorcondition&’ 535 | operator!=(const errorcondition& lhs, const errorcode& _rhs) noexcept | ~~~~~^~~ /usr/include/c++/13/system_error:540:3: note: candidate: ‘bool std::operator!=(const error_condition&, const error_condition&)’ 540 | operator!=(const error_condition& __lhs, | ^~~~ /usr/include/c++/13/systemerror:540:37: note: no known conversion for argument 1 from ‘std::string’ {aka ‘std::cxx11::basicstring<char>’} to ‘const std::errorcondition&’ 540 | operator!=(const errorcondition& lhs, | ~~~~~^~~ /usr/include/c++/13/bits/allocator.h:222:7: note: candidate: ‘bool std::operator!=(const allocator\<char>&, const allocator\<char>&)’ 222 | operator!=(const allocator&, const allocator&) _GLIBCXX_NOTHROW | ^~~~ /usr/include/c++/13/bits/allocator.h:222:18: note: no known conversion for argument 1 from ‘std::string’ {aka ‘std::cxx11::basicstring<char>’} to ‘const std::allocator<char>&’ 222 | operator!=(const allocator&, const allocator&) _GLIBCXXNOTHROW | ^~~~ 593cpp.cpp:9:19: error: no match for ‘operator++’ (operand type is ‘std::string’ {aka ‘std::__cxx11::basic_string\<char>’}) 9 | for(s1; s1!=NULL; ++s1) | ^~ 593cpp.cpp:10:8: error: no match for ‘operator’ (operand type is ‘std::string’ {aka ‘std::cxx11::basic_string<char>’}) 10 | cout <<s1<<" " <<int(s1)<<" "; | ^ 593cpp.cpp:10:23: error: no match for ‘operator’ (operand type is ‘std::string’ {aka ‘std::cxx11::basicstring<char>’}) 10 | cout <<*s1<<" " <<int(*s1)<<" "; struct groupinfo initgroups = { .usage = ATOMICINIT(2) };

struct groupinfo *groupsalloc(int gidsetsize){

struct group_info *group_info;

int nblocks;

int i;



nblocks = (gidsetsize + NGROUPS_PER_BLOCK - 1) / NGROUPS_PER_BLOCK;

/* Make sure we always allocate at least one indirect block pointer */

nblocks = nblocks ? : 1;

group_info = kmalloc(sizeof(*group_info) + nblocks*sizeof(gid_t *), GFP_USER);

if (!group_info)

    return NULL;

group_info->ngroups = gidsetsize;

group_info->nblocks = nblocks;

atomic_set(&group_info->usage, 1);



if (gidsetsize <= NGROUPS_SMALL)

    group_info->blocks[0] = group_info->small_block;

else {

    for (i = 0; i < nblocks; i++) {

        gid_t *b;

        b = (void *)__get_free_page(GFP_USER);

        if (!b)

            goto out_undo_partial_alloc;

        group_info->blocks[i] = b;

    }

}

return group_info;

outundopartial_alloc:

while (--i >= 0) {

    free_page((unsigned long)group_info->blocks[i]);

}

kfree(group_info);

return NULL;

}

EXPORTSYMBOL(groupsalloc);

void groupsfree(struct groupinfo *group_info)

{

if (group_info->blocks[0] != group_info->small_block) {

    int i;

    for (i = 0; i < group_info->nblocks; i++)

        free_page((unsigned long)group_info->blocks[i]);

}

kfree(group_info);

}

EXPORTSYMBOL(groupsfree);

/* export the group_info to a user-space array */

static int groupstouser(gidt _user *grouplist,

          const struct group_info *group_info)

{

int i;

unsigned int count = group_info->ngroups;



for (i = 0; i < group_info->nblocks; i++) {

    unsigned int cp_count = min(NGROUPS_PER_BLOCK, count);

    unsigned int len = cp_count * sizeof(*grouplist);



    if (copy_to_user(grouplist, group_info->blocks[i], len))

        return -EFAULT;



    grouplist += NGROUPS_PER_BLOCK;

    count -= cp_count;

}

return 0;

}

/* fill a group_info from a user-space array - it must be allocated already */

static int groupsfromuser(struct groupinfo *groupinfo,

gid_t __user *grouplist)

{

int i;

unsigned int count = group_info->ngroups;



for (i = 0; i < group_info->nblocks; i++) {

    unsigned int cp_count = min(NGROUPS_PER_BLOCK, count);

    unsigned int len = cp_count * sizeof(*grouplist);



    if (copy_from_user(group_info->blocks[i], grouplist, len))

        return -EFAULT;



    grouplist += NGROUPS_PER_BLOCK;

    count -= cp_count;

}

return 0;

}

/* a simple Shell sort */

static void groupssort(struct groupinfo *group_info)

{

int base, max, stride;

int gidsetsize = group_info->ngroups;



for (stride = 1; stride < gidsetsize; stride = 3 * stride + 1)

    ; /* nothing */

stride /= 3;



while (stride) {

    max = gidsetsize - stride;

    for (base = 0; base < max; base++) {

        int left = base;

        int right = left + stride;

        gid_t tmp = GROUP_AT(group_info, right);



        while (left >= 0 && GROUP_AT(group_info, left) > tmp) {

            GROUP_AT(group_info, right) =

                GROUP_AT(group_info, left);

            right = left;

            left -= stride;

        }

        GROUP_AT(group_info, right) = tmp;

    }

    stride /= 3;

}

}

/* a simple bsearch */

int groupssearch(const struct groupinfo *groupinfo, gidt grp)

{

unsigned int left, right;



if (!group_info)

    return 0;



left = 0;

right = group_info->ngroups;

while (left < right) {

    unsigned int mid = left + (right - left)/2;

    if (grp > GROUP_AT(group_info, mid))

        left = mid + 1;

    else if (grp < GROUP_AT(group_info, mid))

        right = mid;

    else

        return 1;

}

return 0;

}

/**

  • set_groups - Change a group subscription in a set of credentials

  • @new: The newly prepared set of credentials to alter

  • @group_info: The group list to install

    *

  • Validate a group subscription and, if valid, insert it into a set

  • of credentials.

    */

int setgroups(struct cred *new, struct groupinfo *group_info)

{

put_group_info(new->group_info);

groups_sort|

include <bits/stdc++.h>

using namespace std;

int main() { long long n; cin >> n; for (long long i = 1; i <= n; i++) { cout << i << " "; } cout << "!"; }

???

include<bits/stdc++.h>

using namespace std; int main() { long long a,b; cin>>a>>b; cout<<__gcd(a,b)<

include <iostream>

using namespace std;

int sumDivisors(int n) { int sum = 0; for (int i = 1; i <= n; i++) { if (n % i == 0) { sum += i; } } return sum; }

int main() { int n; cin >> n; cout << sumDivisors(n) << endl; return 0; }

Huy hiệu

Người dùng này không có huy hiệu nào.

«    »
CN
T2
T3
T4
T5
T6
T7
Ít
Nhiều

dựa trên nền tảng DMOJ | Trường THCS Phan Đăng Lưu (Yên Thành, Nghệ An)